Skip to main content
Agent handoff enables a one agent to delegate tasks to others agents based on the user’s request. This pattern is useful for building multi-agent systems where different agents have specific capabilities, and a central agent routes requests to the appropriate specialist.

Overview

Handoffs allow you to:
  • Route requests: A router agent analyzes user input and delegates to the right specialist
  • Specialize agents: Create focused agents for specific tasks (jokes, facts, code, etc.)
  • Share conversation context: Handoff agents can share conversation history for continuity
  • Build hierarchical systems: Combine multiple specialists under one entry point
Unlike Agent as a Tool where the parent agent calls sub-agents as tools and continues processing, handoffs transfer control entirely to the target agent, which then responds directly to the user.

Creating a Handoff

To create a handoff, use agents.NewHandoff() with the target agent:

NewHandoff Parameters

Using Handoffs with a Router Agent

Handoffs are configured on the router agent using the Handoffs field in AgentConfig:
The router agent uses the handoff descriptions to determine which agent should handle each request. Write clear, specific descriptions to help the router make accurate routing decisions.

Complete Example

Here’s a complete example demonstrating a router agent that delegates to specialized joke and fact agents: