Handoff
Agent-to-agent task delegation and collaboration
Agent Handoff System
The handoff system enables seamless task delegation between specialised agents, allowing complex workflows where each agent contributes their expertise.
Key Concepts
Agents can transfer conversations to specialists based on context and requirements
Full conversation history and context are maintained during handoffs
Handoffs appear as tools that agents can invoke naturally
Dynamic routing based on conversation context and agent expertise
Quick Start
Handoff Configuration
Basic Parameters
Parameter | Type | Description | Default |
---|---|---|---|
agent | Agent | Target agent for handoff | Required |
tool_name_override | str | Custom name for handoff tool | transfer_to_<agent_name> |
tool_description_override | str | Custom description | Auto-generated |
on_handoff | Callable | Callback function | None |
input_filter | Callable | Filter for conversation data | None |
Handoff Filters
Advanced Features
Structured Input Types
Use Pydantic models for typed handoff data:
Callback Patterns
Complete Example
Best Practices
Define specific expertise for each agent to ensure proper routing
Use input filters to manage conversation history size
Implement callbacks to handle failed handoffs gracefully
Limit handoff chains to prevent excessive delegation
Integration with Agent Instructions
The handoff system automatically enhances agent prompts: