Skip to main content
The --handoff flag enables agent-to-agent task delegation, allowing multiple specialized agents to collaborate on complex tasks.

Quick Start

Usage

Basic Handoff

Expected Output:

Multi-Agent Chain

Expected Output:

Handoff Configuration Options

Context Policies

Combine with Other Features

YAML Equivalent

Every --handoff* flag has a YAML equivalent under the agent’s handoff: block:

How It Works

  1. Parse Agents: The handoff string is parsed into agent names
  2. Create Chain: Agents are created with handoff capabilities
  3. Sequential Execution: Each agent processes and hands off to the next
  4. Context Passing: Previous agent’s output becomes next agent’s input
  5. Final Output: Last agent’s response is returned

Agent Naming

Agents are automatically configured based on their names:

Custom Agent Names

You can use any name - agents will be configured with generic roles:

Use Cases

Content Creation Pipeline

Code Review Workflow

Data Analysis Pipeline

Research to Report

Handoff Patterns

Research → Write

Research a topic, then write about it

Code → Review

Write code, then review it

Analyze → Report

Analyze data, then create report

Plan → Execute → Review

Full workflow with planning

Best Practices

Order agents logically - each agent should build on the previous agent’s work.
Long handoff chains increase latency and token usage. Keep chains focused and efficient.

Logical Order

Arrange agents in a logical workflow sequence

Specialized Agents

Use descriptive names that indicate specialization

Chain Length

Keep chains to 2-4 agents for efficiency

Clear Tasks

Ensure each agent has a clear, distinct role

Monitoring Handoffs

Use --metrics to see token usage across all agents:
Expected Output: