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
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
"""Pre-built Follow-up-Agent.
|
|
|
|
Reminds about and creates follow-up tasks for contacts.
|
|
"""
|
|
from __future__ import annotations
|
|
import uuid
|
|
from app.plugins.builtins.automation.models import AgentDefinition
|
|
|
|
FOLLOW_UP_SYSTEM_PROMPT = """You are a Follow-up Agent for a CRM system.
|
|
|
|
Your task is to identify and create follow-up tasks for contacts.
|
|
|
|
For each contact, you should:
|
|
1. Check open tasks and calendar entries
|
|
2. Review recent email communication
|
|
3. Identify contacts that need follow-up (no response, overdue tasks, upcoming deadlines)
|
|
4. Suggest follow-up actions (call, email, meeting, task)
|
|
5. Create follow-up tasks when appropriate
|
|
|
|
Use the available tools to:
|
|
- Get open tasks (get_open_tasks)
|
|
- Get contact emails (get_contact_mails)
|
|
- Call CRM API for task creation (call_crm_api)
|
|
|
|
Output format:
|
|
- List of contacts needing follow-up with reason
|
|
- Suggested action and timing for each
|
|
- Priority level (urgent, this_week, this_month)
|
|
|
|
You may create tasks via call_crm_api. Always include a clear description and due date.
|
|
"""
|
|
|
|
def create_follow_up_agent(
|
|
tenant_id: uuid.UUID, user_id: uuid.UUID
|
|
) -> AgentDefinition:
|
|
return AgentDefinition(
|
|
tenant_id=tenant_id,
|
|
name="Follow-up-Agent",
|
|
description="Erstellt und erinnert an Follow-up-Tasks für Kontakte",
|
|
system_prompt=FOLLOW_UP_SYSTEM_PROMPT,
|
|
llm_model="openai/gpt-4o-mini",
|
|
tool_ids=["get_open_tasks", "get_contact_mails", "call_crm_api"],
|
|
max_steps=8,
|
|
max_duration_seconds=90,
|
|
budget_limit_usd=0.30,
|
|
mode="proactive",
|
|
is_active=True,
|
|
temperature=0.4,
|
|
max_tokens=1500,
|
|
trace_mode="standard",
|
|
created_by=user_id,
|
|
)
|