Skip to main content
This example demonstrates how to build a complete customer support system that can handle inquiries, route to specialists, and escalate to humans when needed.

What You’ll Learn

  • Building customer service agent workflows
  • Intelligent ticket routing and triage
  • Integration with knowledge bases
  • Human-in-the-loop escalation
  • Multi-channel support (web, API)

Prerequisites

1

Install AutoGen and web framework

2

Set your OpenAI API key

Architecture

The customer support system uses:
  • Triage Agent: Routes inquiries to the right specialist
  • Specialist Agents: Handle billing, technical, and general support
  • Escalation Agent: Determines when to involve humans
  • Knowledge Base: Stores FAQs and solutions

Code Example

Run the Example

Expected Output

FastAPI Integration

Create a web API for the support system:
Run the API:
Test with curl:

Key Concepts

Intelligent Routing

Triage agent routes inquiries to the right specialist automatically.

Handoffs

Agents can transfer complex issues to specialists or escalation.

Knowledge Base

Common solutions and policies embedded in agent context.

Human Escalation

Automatic escalation for complex or sensitive issues.

Best Practices

  1. Clear Routing Logic: Define when to use each specialist
  2. Empathetic Tone: Train agents to be understanding and helpful
  3. Knowledge Integration: Keep knowledge base up-to-date
  4. Escalation Thresholds: Define clear criteria for human involvement
  5. Response Tracking: Log all interactions for analysis
  6. Privacy: Don’t expose sensitive customer data to LLMs

Production Enhancements

Add Session Management

Add Analytics

Add Sentiment Analysis

Troubleshooting

Agent Not Routing Correctly

Improve routing instructions in triage agent:

No Escalation When Needed

Add explicit escalation triggers:

Next Steps

Data Analysis

Build automated data analysis agents

Teams Documentation

Learn more about team patterns