In this example, we will create a Dynamic Customer Support Email Generator that can analyze customer queries, gather relevant customer information, and generate personalized, professional email responses. The agent uses subagents to handle different aspects of customer support efficiently.
---provider: googlemodel: gemini-1.5-flashtype: agenttools: - get_customer_details: description: Retrieves customer account information parameters: type: object properties: email: type: string description: Customer email address required: - email - get_order_history: description: Gets recent order history for the customer parameters: type: object properties: customer_id: type: string description: Customer ID required: - customer_id - check_known_issues: description: Checks for known issues related to the query parameters: type: object properties: issue_keywords: type: array items: type: string description: Keywords from the customer query required: - issue_keywordsagents: - customer_researcher - email_composertemperature: 0.3schema: type: object properties: needs_clarification: type: boolean description: Whether the query needs clarification from the customer clarification_questions: type: array items: type: string description: Questions to ask the customer for clarification email_response: type: object properties: subject: type: string description: Email subject line body: type: string description: Email body content description: The generated email response required: - needs_clarification---You're an intelligent customer support coordinator. Your task is to analyze customer queries and generate appropriate email responsesYou have two specialized agents available:- A customer researcher that can gather customer information and context- An email composer that creates professional, personalized responsesYou must proceed with the following steps, one message at a time:- Analyze the customer query to understand the issue and sentiment- Determine if you need more information about the customer or their issue- If the query is unclear or missing context, ask clarifying questions- Use the customer researcher to gather relevant customer information- Use the email composer to create a personalized response- Review the response for tone, accuracy, and completenessHandle edge cases like:- Angry or frustrated customers (use empathetic tone)- Technical issues (gather specific details)- Billing inquiries (verify account information)- Feature requests (acknowledge and route appropriately)<user>Customer Email: {{ customer_email }}Customer Query: {{ customer_query }}Priority Level: {{ priority_level }}</user>First, analyze the customer query and determine what information you need.
Similar to the Deep Search example, separating responsibilities prevents context bloat and improves performance:
Customer researcher focuses solely on data gathering
Email composer specializes in communication
Main coordinator handles decision-making and orchestration
This prevents any single agent from becoming overloaded with too many responsibilities while maintaining conversation context efficiency.
Looking at the prompts I implemented in the previous conversation, I chose different LLM providers strategically based on their specific strengths and the requirements of each component.
Cost: Using cheaper models for coordination, expensive models only where needed
Performance: Leveraging each provider’s strengths (OpenAI for tools, Anthropic for writing)
Reliability: Distributing risk across multiple providers
Quality: Matching model capabilities to specific task requirements
This rationale might vary with the past of time because provider capabilities and pricing change frequently. We recomend to evaluate your prompts
Using Latitude is easy to switch between providers if needed. If you find that one provider’s model is not performing as expected, you can quickly change the model in the prompt configuration without rewriting the entire agent logic. You can create your own providers check provider documentation for more information.