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.
Basic setup
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
onEventon the handoff options.
Context modes
Control how much conversation history the specialist sees:"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
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.