Skip to main content
The supervisor pattern enables you to build multi-agent systems where a central supervisor agent coordinates and delegates tasks to specialized worker agents. This is ideal for complex workflows requiring task decomposition and intelligent routing.

What is a Supervisor?

A supervisor agent acts as an intelligent orchestrator that:
  • Routes user requests to the most appropriate specialist agent
  • Manages handoffs between multiple agents
  • Evaluates worker outputs and decides next steps
  • Coordinates multi-step workflows across different domains
Use architecture: "supervisor" to enable supervisor-based multi-agent coordination. The supervisor dynamically routes tasks without requiring explicit edges.

When to Use Supervisors

Best For

  • Multi-domain systems (e.g., research + analysis + writing)
  • Complex workflows requiring task delegation
  • Systems with specialized agent teams
  • Dynamic routing based on request type

Capabilities

  • ✅ Streaming support
  • ✅ Tool calling (for handoffs)
  • ✅ Memory support
  • ✅ Dynamic agent routing
  • ✅ Agent handoffs
  • ✅ Workflow coordination

Supervisor Configuration

Basic Structure

Supervisor architecture must not define explicit edges. Routing is handled dynamically by the supervisor via handoff tools. Adding edges will cause a validation error.

Supervisor Parameters

array
required
List of agent names that this supervisor coordinates. These must match agent names defined in the agents list. The supervisor must have at least one supervised agent.
boolean
default:"true"
Controls coordination flow:
  • true (default): Iterative coordination — worker returns to supervisor for evaluation and next steps
  • false: One-way delegation — worker responds directly to the user (routes to END)
integer
default:"10"
Maximum number of agent handoffs to prevent infinite coordination loops.
string
System prompt defining the supervisor’s coordination strategy. Should clearly describe each worker’s role and delegation instructions. This is configured via the standard prompt_config block (there is no separate supervisor_prompt field).

Coordination Patterns

One-Way Delegation

Set return_to_supervisor: false for simple routing:
The supervisor analyzes the request, routes to the appropriate worker, and the worker responds directly to the user. Use when:
  • Tasks are simple and don’t require multi-step coordination
  • Each agent can complete its work independently
  • You want minimal overhead

Iterative Coordination

Set return_to_supervisor: true for multi-step workflows:
The supervisor evaluates each worker’s output and orchestrates the next step. Use when:
  • Tasks require multiple agents working in sequence
  • Supervisor needs to evaluate intermediate results
  • Complex workflows with conditional routing

Complete Example

Here’s a research team supervisor coordinating three specialized agents:

Best Practices

Clear role definitions: In prompt_config.system_prompt, clearly describe each worker agent’s expertise and when to use them
Mix agent types: Combine ReAct agents (for tool use) with LLM agents (for synthesis) under a supervisor for powerful multi-domain systems
Immediate delegation: Instruct the supervisor to delegate immediately without attempting to answer directly
Set appropriate max_handoffs limits to prevent infinite coordination loops
Use return_to_supervisor: true when the supervisor needs to evaluate intermediate results and orchestrate multi-step workflows. Set to false for simpler one-way delegation.

Supervisor vs Workflow Architecture

Use supervisors when you need intelligent task delegation and don’t want to define all possible paths
Use workflows when you need explicit control over agent transitions and conditional routing

Common Use Cases

Setup: Supervisor + research agent + writer agent + editor agentThe supervisor routes tasks: research gathers info, writer creates content, editor polishes.
Setup: Supervisor + technical support + billing support + general supportThe supervisor classifies requests and routes to the appropriate specialist.
Setup: Supervisor + data collector + analyzer + visualizerThe supervisor coordinates: collector gathers data, analyzer processes it, visualizer creates reports.
Setup: Supervisor + multiple domain-specific ReAct agentsEach agent is an expert in a specific domain (legal, medical, technical). Supervisor routes based on domain.

Next Steps

Agent Types

Learn about different agent types to use as workers

Workflow Patterns

Compare with workflow-based multi-agent patterns

YAML Configuration

Complete YAML reference for all parameters

Tool Configuration

Configure tools for ReAct worker agents