8ed6d27885
Check Cross-Plugin Imports / check (push) Has been cancelled
- F-WORK: app/ai/agent_workstream.py (201 lines) — post_agent_message, post_agent_step, post_agent_result, post_approval_request - F-EMAIL: prebuilt/email_triage_agent.py — E-Mail-Triage-Agent with 3 tools, max 10 steps, $0.50 budget - F-CONTACT: prebuilt/contact_enrichment_agent.py — Contact-Enrichment-Agent with 3 tools, max 8 steps, $0.30 budget - F-FOLLOW: prebuilt/follow_up_agent.py — Follow-up-Agent with 3 tools, max 8 steps, $0.30 budget - F-REPORT: prebuilt/report_agent.py — Report-Agent with 2 tools, max 12 steps, $0.50 budget - All compile checks pass
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
"""Pre-built Report-Agent.
|
|
|
|
Generates reports from CRM data using search and API tools.
|
|
"""
|
|
from __future__ import annotations
|
|
import uuid
|
|
from app.plugins.builtins.automation.models import AgentDefinition
|
|
|
|
REPORT_SYSTEM_PROMPT = """You are a Report Agent for a CRM system.
|
|
|
|
Your task is to generate reports from CRM data.
|
|
|
|
You can:
|
|
1. Search for contacts, companies, and activities using hybrid search
|
|
2. Call CRM API for structured data (contacts, companies, tasks, calendar)
|
|
3. Aggregate and summarize data into reports
|
|
4. Format reports as markdown with tables and sections
|
|
|
|
Report types you can generate:
|
|
- Contact activity summary (interactions, emails, tasks per contact)
|
|
- Sales pipeline overview (contacts by status, recent changes)
|
|
- Task completion report (open vs done, overdue, by assignee)
|
|
- Communication summary (email volume, response times)
|
|
- Custom reports based on user request
|
|
|
|
Use the available tools to gather data, then format a clear, structured report.
|
|
Include relevant metrics, dates, and entity references.
|
|
Be concise but comprehensive. Use markdown formatting.
|
|
"""
|
|
|
|
def create_report_agent(
|
|
tenant_id: uuid.UUID, user_id: uuid.UUID
|
|
) -> AgentDefinition:
|
|
return AgentDefinition(
|
|
tenant_id=tenant_id,
|
|
name="Report-Agent",
|
|
description="Generiert Berichte aus CRM-Daten",
|
|
system_prompt=REPORT_SYSTEM_PROMPT,
|
|
llm_model="openai/gpt-4o-mini",
|
|
tool_ids=["call_crm_api", "hybrid_search"],
|
|
max_steps=12,
|
|
max_duration_seconds=180,
|
|
budget_limit_usd=0.50,
|
|
mode="reactive",
|
|
is_active=True,
|
|
temperature=0.3,
|
|
max_tokens=3000,
|
|
trace_mode="standard",
|
|
created_by=user_id,
|
|
)
|