A central orchestrator coordinates multiple specialized agents.
Overview
The supervisor pattern uses a hierarchical structure where a central orchestrator acts as a supervisor, managing and coordinating multiple specialized AI agents. The supervisor:
- Analyzes incoming requests.
- Breaks down complex tasks.
- Delegates to appropriate agents.
- Aggregates and synthesizes results.
- Delivers unified responses.
User Request ā Supervisor ā [Agent A, Agent B, Agent C] ā Aggregated Response
When to Use
The supervisor pattern is ideal when:
- Requests require dynamic agent selection at runtime.
- Tasks can be decomposed into independent subtasks.
- Multiple specialists should contribute to responses.
- You want centralized control over coordination.
- Conflict resolution between agents is needed.
Good Fit Examples
| Use Case | Why Supervisor Works |
|---|
| Customer service | Billing, orders, and tech support agents work independently |
| Research assistant | Multiple agents gather info from different sources |
| Travel booking | Flight, hotel, and car rental agents coordinate |
| Financial planning | Investment, tax, and insurance agents provide comprehensive advice |
Architecture
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Agentic App ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā User Request ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā
ā ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Supervisor ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā 1. Analyze request ā ā ā
ā ā ā 2. Decompose into subtasks ā ā ā
ā ā ā 3. Select agents ā ā ā
ā ā ā 4. Delegate tasks ā ā ā
ā ā ā 5. Aggregate results ā ā ā
ā ā ā 6. Resolve conflicts ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā
ā āāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāā ā
ā ā ā ā ā
ā ā¼ ā¼ ā¼ ā
ā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā ā
ā ā Agent A ā ā Agent B ā ā Agent C ā ā
ā ā (Billing) ā ā (Orders) ā ā (Support) ā ā
ā āāāāāāāā¬āāāāāāāā āāāāāāāā¬āāāāāāāā āāāāāāāā¬āāāāāāāā ā
ā ā ā ā ā
ā āāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāā ā
ā ā ā
ā ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Aggregated Response ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Execution Flow
The Seven Stages
1. User Input
āā Request arrives at the application
2. Supervisor Analysis
āā Parse intent, identify required capabilities
3. Task Decomposition
āā Break complex request into subtasks
4. Agent Selection & Delegation
āā Route subtasks to specialized agents
5. Agent Execution
āā Agents process as per the assigned tasks
6. Result Aggregation
āā Collect outputs from all agents
7. Response Synthesis
āā Resolve conflicts, generate unified response
Example Conversation
User: "I need to return my order and get a refund. Also,
can you explain your return policy?"
Supervisor Analysis:
āāā Subtask 1: Process return request (Order Agent)
āāā Subtask 2: Initiate refund (Billing Agent)
āāā Subtask 3: Explain return policy (Support Agent)
Agent Execution:
āāā Order Agent: Initiates return for order #12345
āāā Billing Agent: Queues refund of $89.99
āāā Support Agent: Retrieves return policy
Aggregated Response:
"I've initiated the return for your order #12345.
A refund of $89.99 will be processed within 3-5
business days once we receive the item.
Our return policy: Items can be returned within
30 days of purchase in original condition. Electronics
have a 15-day window. Free return shipping is included."
Configuration
# app-config.yaml
orchestration:
pattern: supervisor
model: gpt-4o # Model for supervisor decisions
# Supervisor behavior
decomposition: auto # auto | manual
agents:
billing_agent:
name: Billing Agent
description: Handles payments, refunds, and billing inquiries
order_agent:
name: Order Agent
description: Manages orders, returns, and shipping
support_agent:
name: Support Agent
description: Answers policy questions and general support
Key Capabilities
Modularity
Each agent focuses on a specific domain, making the system easier to build and maintain.
āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā
ā Billing ā ā Orders ā ā Support ā
ā Domain ā ā Domain ā ā Domain ā
āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā
Scalability
Distribute complex tasks across multiple specialized agents.
Single Request ā Supervisor ā Agent A ā Agent B ā Unified Response
Specialization
Each agent can use different models, tools, and knowledge optimized for their domain.
billing_agent:
model: gpt-4o # Best for financial accuracy
tools: [process_refund, check_payment_status]
support_agent:
model: gpt-3.5-turbo # Faster for simple lookups
knowledge: [faq_database, policy_docs]
Flexibility
The supervisor dynamically selects agents based on request needs.
Fault Tolerance
If one agent fails, others can still complete their tasks.
Benefits
| Benefit | Description |
|---|
| Centralized control | Single point of coordination |
| Specialized agents | Domain experts handle domain tasks |
| Comprehensive responses | Multiple perspectives combined |
| Fault tolerance | System continues if one agent fails |
Limitations
| Limitation | Mitigation |
|---|
| Supervisor overhead | Use efficient models for coordination |
| Latency from aggregation | Set agent timeouts |
| Complexity | Start simple, add agents as needed |
| Potential bottleneck | Optimize supervisor logic |
Example: Customer Service Assistant
name: Customer Service Hub
orchestration:
pattern: supervisor
agents:
- name: Billing Agent
description: |
Handles billing inquiries, payment processing, refunds,
and invoice management.
tools:
- check_payment_status
- process_refund
- generate_invoice
knowledge:
- billing_faqs
- name: Order Agent
description: |
Manages order status, shipping updates, modifications,
and returns.
tools:
- get_order_status
- update_shipping
- initiate_return
knowledge:
- shipping_policies
- name: Product Agent
description: |
Answers product questions, provides recommendations,
and checks availability.
tools:
- search_products
- check_inventory
- get_product_details
knowledge:
- product_catalog
- name: Support Agent
description: |
Handles general inquiries, policy questions, and
escalations.
tools:
- create_ticket
- escalate_to_human
knowledge:
- company_policies
- support_faqs