Skip to main content
Declare which agents can hand off to which — and their execution limits — directly in 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 same Agent.handoffs with the same HandoffConfig.

How It Works

The adapter runs a wiring pass after every agent is built, then resolves each to: role by name. Unknown target roles are logged and skipped — they never raise.

Configuration Options

Every key under handoff: 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:
Safe chains — cap depth and refuse cycles for deep delegation graphs:

Best Practices

_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.
The default depth is 10. For a simple triage router, set max_depth: 1 so a request cannot bounce through multiple specialists.
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.
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.

Agent Handoffs

The full Python handoff API and context policies

Handoff Tool Policy

Control which tools a target agent inherits on handoff