55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
"""Pre-built Contact-Enrichment-Agent.
|
|
|
|
Enriches contact data by searching for related information.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import uuid
|
|
|
|
from app.plugins.builtins.automation.models import AgentDefinition
|
|
|
|
CONTACT_ENRICHMENT_SYSTEM_PROMPT = """You are a Contact Enrichment Agent for a CRM system.
|
|
|
|
Your task is to enrich contact profiles with additional information.
|
|
|
|
For each contact, you should:
|
|
1. Search for related entities (companies, other contacts)
|
|
2. Check audit history for recent interactions
|
|
3. Find semantic matches in the database
|
|
4. Suggest missing fields that could be filled
|
|
5. Identify potential duplicates
|
|
|
|
Use the available tools to:
|
|
- Search for related entities (search_related)
|
|
- Get entity history (get_contact_history)
|
|
- Call CRM API for data lookup (call_crm_api)
|
|
|
|
Output format:
|
|
- Enrichment suggestions as structured data
|
|
- Confidence score for each suggestion
|
|
- Source reference for each piece of information
|
|
|
|
Do NOT modify contacts. You are advisory only.
|
|
"""
|
|
|
|
def create_contact_enrichment_agent(
|
|
tenant_id: uuid.UUID, user_id: uuid.UUID
|
|
) -> AgentDefinition:
|
|
return AgentDefinition(
|
|
tenant_id=tenant_id,
|
|
name="Contact-Enrichment-Agent",
|
|
description="Reichert Kontaktdaten mit verwandten Informationen an",
|
|
system_prompt=CONTACT_ENRICHMENT_SYSTEM_PROMPT,
|
|
llm_model="openai/gpt-4o-mini",
|
|
tool_ids=["search_related", "get_contact_history", "call_crm_api"],
|
|
max_steps=8,
|
|
max_duration_seconds=90,
|
|
budget_limit_usd=0.30,
|
|
mode="reactive",
|
|
is_active=True,
|
|
temperature=0.2,
|
|
max_tokens=1500,
|
|
trace_mode="standard",
|
|
created_by=user_id,
|
|
)
|