Orchestrator
The Orchestrator is a specialized agent that provides centralized coordination, intelligent routing, and execution planning for complex multi-agent workflows. It acts as a traffic controller, analyzing user requests and delegating work to the most appropriate agents.The Orchestrator complements Workflows by providing dynamic, LLM-driven routing as opposed to static DAG-based orchestration.
When to Use the Orchestrator
Choose the Orchestrator for:Dynamic Routing
When the sequence of agents needed depends on request content and cannot be predetermined
Adaptive Planning
When the LLM needs to decide which agents to call based on intermediate results
Conversational Flow
When users might change direction mid-conversation, requiring flexible orchestration
Agent Discovery
When you want automatic selection from available agents based on capabilities
- Deterministic, repeatable processes
- Complex control flow (loops, conditionals, maps)
- Guaranteed execution order
- Compliance and audit requirements
Architecture
The Orchestrator is implemented as a standard agent with specialized tools:Core Components
Agent Registry Access
The Orchestrator subscribes to agent discovery and maintains an up-to-date registry of available agents and their capabilities
Capability Matching
Uses agent cards (schemas, skills, descriptions) to match user requests to appropriate agents
Configuration
Basic Orchestrator Setup
orchestrator.yaml
Orchestrator Tools
The Orchestrator uses specialized MCP tools for agent coordination:list_agents
Query the agent registry to discover available agents:call_agent
Delegate a subtask to another agent:Execution Flow
Here’s how the Orchestrator handles a complex request:Orchestration Patterns
Sequential Delegation
Sequential Delegation
Call agents one after another, passing results forward:Use when: Tasks have clear dependencies and must run in order
Parallel Delegation
Parallel Delegation
Call multiple agents concurrently for independent tasks:Use when: Subtasks are independent and can run concurrently
Conditional Routing
Conditional Routing
Choose agents dynamically based on intermediate results:Use when: Route depends on request analysis or classification
Iterative Refinement
Iterative Refinement
Loop with an agent until quality threshold met:Use when: Output requires iterative improvement
Agent Registry Integration
The Orchestrator maintains an active agent registry through discovery:Agent Card Schema
Agents advertise capabilities via agent cards:- Match user intent to agent capabilities
- Validate input/output compatibility between agents
- Check permission requirements
- Provide intelligent suggestions to users
Error Handling & Recovery
The Orchestrator implements robust error handling:Agent Failure Recovery
Timeout Handling
Orchestrator can set timeouts for agent calls:- Orchestrator receives timeout error
- Can decide to retry, use partial results, or switch agents
- Notifies user about delays
Advanced Features
Context Propagation
Pass artifacts and context between agents:User Interaction
Orchestrator can ask for user input during execution:Cost Optimization
Orchestrator can optimize for cost:Monitoring & Observability
Track Orchestrator performance:Agent Call Metrics
- Number of agent invocations per request
- Success/failure rates by agent
- Average latency per agent
- Cost per orchestration session
Routing Analytics
- Most frequently called agent combinations
- Common routing patterns
- Failed routing attempts
- User satisfaction by routing strategy
Logging Best Practices
Structured logging for orchestration decisions:Orchestrator vs Workflow Comparison
| Feature | Orchestrator | Workflow |
|---|---|---|
| Routing Logic | Dynamic (LLM-driven) | Static (predefined DAG) |
| Flexibility | Adapts to request content | Fixed structure |
| Predictability | Variable execution path | Deterministic |
| Complexity | Simpler config, complex behavior | Complex config, predictable |
| Use Case | Conversational, exploratory | Production, compliance |
| Error Recovery | LLM decides strategy | Predefined retry policies |
| Cost | Variable (LLM calls) | Fixed (DAG execution) |
| Control Flow | Inferred by LLM | Explicit (loops, branches) |
Best Practices
Clear Agent Descriptions
Clear Agent Descriptions
Ensure all agents have:
- Precise capability descriptions
- Well-defined input/output schemas
- Example use cases in agent card
- Clear scope boundaries
Orchestrator Instruction Design
Orchestrator Instruction Design
- Provide explicit routing guidelines
- Include examples of successful orchestrations
- Define fallback strategies for failures
- Set clear quality criteria for results
Testing Routing Logic
Testing Routing Logic
Test orchestration with:
- Simple single-agent requests
- Complex multi-agent workflows
- Edge cases (missing agents, timeouts)
- User clarification scenarios
- Performance under load
Performance Optimization
Performance Optimization
- Use agent capability caching
- Implement request deduplication
- Set appropriate timeouts
- Monitor and optimize slow paths
- Consider parallel execution where safe
Limitations & Considerations
When NOT to use Orchestrator:- Regulatory compliance requiring audit trails
- Real-time systems needing predictable latency
- High-volume batch processing
- Simple linear workflows with known steps
Next Steps
Workflows
Learn about static DAG-based orchestration
A2A Protocol
Deep dive into agent communication
Agents
Build specialized agents for orchestration
Agent Cards
Design effective capability advertisements