agents.yaml.
Quick Start
1
Declare handoff: in agents.yaml
Add a
handoff: block under any agent. to: lists the target agent keys.2
Run it
The adapter wires the
handoff: dict into core Agent.handoffs — no Python required.Three Surfaces, Same Wiring
YAML, CLI, and Python all populate the sameAgent.handoffs with the same HandoffConfig.
- YAML
- CLI
- Python
How It Works
The adapter runs a wiring pass after every agent is built, then resolves eachto: role by name.
Unknown target roles are logged and skipped — they never raise.
Configuration Options
Every key underhandoff: maps onto a field of core HandoffConfig.
Only keys that are present are forwarded. Omit a key to keep the
HandoffConfig default.Common Patterns
Triage router — one agent fans out to specialists with a single-hop limit:Best Practices
Match to: entries to agent keys, not display names
Match to: entries to agent keys, not display names
_wire_handoffs resolves each to: value against the agent keys in the same agents: map. A typo is logged and skipped, so the handoff silently disappears — check your logs if a target never fires.Set max_depth for router agents
Set max_depth for router agents
The default depth is
10. For a simple triage router, set max_depth: 1 so a request cannot bounce through multiple specialists.Keep detect_cycles on
Keep detect_cycles on
Cycle detection defaults to
true. Leave it enabled unless you have a deliberate loop — it prevents two agents from handing off to each other forever.policy: is a no-op today
policy: is a no-op today
The wrapper
policy: key (e.g. round-robin) has no core equivalent yet, so it is parsed but ignored. Do not rely on it to change routing behaviour.Related
Agent Handoffs
The full Python handoff API and context policies
Handoff Tool Policy
Control which tools a target agent inherits on handoff

