Skip to main content
A handoff wraps another Agent as a tool. From the parent agent’s perspective it’s just another tool call — but internally kenpachi spins up the specialist, runs it to completion, and returns the answer as plain text. This is the pattern behind “triage → billing / support / sales” flows, without writing routing logic yourself.
Rule of thumb: one front-door agent with handoff tools; each specialist owns its own tools and instructions (via provider system prompt or separate agent setup).

Basic setup

The parent model decides when to delegate. You describe each specialist in the handoff’s description — that’s what the model reads to pick the right one.

How it works internally

Key details:
  • The sub-agent runs via Agent.spawn() — the parent’s context and tools are not mutated.
  • The handoff tool returns a plain text string, not a nested object.
  • You can observe inner events with onEvent on the handoff options.

Context modes

Control how much conversation history the specialist sees:
Use "none" for specialists that should stay focused. Use "full" when the specialist needs full thread context (e.g. “what did I ask earlier?”).

Observing delegation

The handoff’s onEvent fires for events inside the sub-agent run. The parent’s onEvent sees the handoff as a normal tool call/result.

When to use handoffs vs. one big agent

Start with one agent + tools. Add handoffs when the tool list grows or specialists need isolation.