Customer Support Email Generator
Learn how to build an intelligent customer support agent that generates personalized email responses
Live example
You can play with this example in the Latitude Playground.
Overview
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.
Multi-Agent Architecture
The system uses specialized subagents for different responsibilities:
- main: Orchestrates the process and makes decisions
- customer_researcher: Gathers customer data and context
- email_composer: Creates the actual email response
All the tools used in the sub-agents have to be defined in the main prompt.
The prompts
Breakdown
Let’s break down the example step by step to understand how it works.
Customer Context Gathering
The customer researcher agent uses custom tools to fetch relevant information:
Intelligent Query Analysis
The main agent analyzes queries for:
- Emotional sentiment (angry, confused, urgent)
- Issue type (technical, billing, feature request)
- Information completeness
- Priority level
Personalized Response Generation
The email composer creates responses that:
- Use customer-specific information
- Match appropriate tone and urgency
- Include relevant account details
- Provide actionable solutions
Structured Output
Uses JSON schema to ensure consistent response format with subject, body, and metadata.
Why This Multi-Agent Approach Works
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.
Code
You can play with this example using the Latitude SDK.
Provider Selection Rationale
Main coordinator - Google Gemini Flash
Main coordinator - Google Gemini Flash
- Fast Performance: Designed for quick coordination tasks.
- Cost Effective: Competitive pricing for simple tasks.
- JSON Support: Good structured output capabilities
Customer researcher - OpenAI GPT-4.1
Customer researcher - OpenAI GPT-4.1
- Tool Integration: OpenAI has excellent tool calling capabilities and strict compatibility mode for reliable function execution
- Data Processing: GPT-4o excels at analyzing and synthesizing information from multiple sources
- Reasoning: Better at complex reasoning tasks required for customer data analysis
Email composer - Anthropic Claude Sonnet
Email composer - Anthropic Claude Sonnet
- Writing Quality: Anthropic models are particularly strong at generating high-quality, nuanced text
- Tone Control: Superior at maintaining consistent professional tone and empathy
- Temperature: Used
temperature: 0.4
for creative but controlled email generation
Strategic Benefits
This multi-provider strategy optimizes for:
- 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
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.
Resources
- Customer Support Best Practices - Learn more about effective customer support prompting
- Custom Tools - How to integrate with customer databases and CRM systems
- Tool call SDK example - A simple example of how to run a prompt with tools with Latitude SDK.
- JSON Schema Output - Ensuring consistent response formatting
- Configuring providers - How to configure and use different LLM providers in Latitude