Skip to main content
Main agent delegates to a math-specialist sub-agent. Tool and delegation approval events from the specialist fan in to the main agent’s stream. Source: examples/agent_with_subagents/

What it demonstrates

  • WithSubAgents registering a specialist with its own tools and a distinct WithName
  • Delegation approval (CUSTOM delegation events) and tool approval from sub-agent streams

Run

From examples/:
Approve delegation and tool calls when prompted on stdin.

Key code

See Sub-agents.

Expected output

The main agent emits a delegation approval event before calling the sub-agent. The sub-agent then calls its tools and approval events fan in to the main agent’s stream.

Learn more

Sub-agents

Depth limits, policies, streaming fan-in

Approvals

Delegation and tool approval