Skip to main content
Handoffs enable agents to delegate tasks to specialized agents, with built-in safety features like cycle detection and depth limits.

Quick Start

1

Create a Handoff

2

Configure Handoff Behavior

3

Execute a Handoff


User Interaction Flow


Handoff

Main struct for defining agent-to-agent transfers.

Methods


HandoffConfig

Configuration for handoff behavior and safety.

Configuration Options

Builder Methods


ContextPolicy

Controls how context is shared during handoffs.

HandoffResult

Result returned from handoff execution.

Factory Methods

Builder Methods


Safety Features

Cycle Detection

Prevents infinite loops between agents.

Depth Limits

Limits how deep handoff chains can go.

Best Practices

Reduces token usage while preserving essential context for the specialist.
Use 3-5 for most workflows. Higher values may indicate design issues.
Keep detect_cycles: true to prevent infinite loops in complex agent networks.
Override tool names to make LLM decisions clearer: transfer_to_code_reviewer.

Agent-Team

Team orchestration

Workflows

Workflow patterns