How It Works
When you add theagents field to an Agent config, the parent becomes a supervisor. It uses an LLM call to analyze the user’s message against each child agent’s instructions and selects the best match.
name and instructions, compares them to the input, and picks one. If the LLM returns an invalid agent name, Runflow falls back to the first agent in the list.
Basic Setup
Specialist Agents with Tools and RAG
Each child agent can have its own tools, RAG configuration, memory, and model — completely independent from other agents:Cost Optimization: Cheap Router, Quality Specialists
The supervisor only classifies intent — it doesn’t generate user-facing responses. Use a fast, cheap model for routing and reserve powerful models for the specialists that do the real work:Routing Logic in Detail
The supervisor builds a prompt like this internally:Shared Memory and Context
Memory is configured on the supervisor and shared across the entire session. If a customer starts with support and then asks about billing, the billing agent has full context of what was discussed:Observability
The supervisor generates traces automatically. Withobservability: 'full', you get:
- Supervisor span: which agents were available, which was selected
- LLM call span: the routing decision (model, tokens, latency)
- Child agent span: the full execution trace of the selected agent
- Tool call spans: every tool the child agent invoked
Fallback Behavior
If the LLM returns an agent name that doesn’t match any key in theagents config, Runflow automatically falls back to the first agent in the list. Design your agent order accordingly — put the most general-purpose agent first:
When to Use Multi-Agent vs Single Agent
Supervisor vs Workflow
The SDK offers two patterns for multi-agent orchestration:
Use the supervisor when you need simple, intent-based routing. Use Workflows when you need multi-step pipelines with explicit branching, parallel execution, or data transformations.
Configuration Reference
Supervisor Agent
Child Agent (within agents)
Each child agent supports the full AgentConfig:
Next Steps
Multi-Agent Example
Complete real-world example with supervisor + 3 specialists
Tools
Create tools for your specialist agents
Knowledge (RAG)
Add knowledge bases to specialists
Workflows
Multi-step pipelines with explicit routing