Skip to main content
Agents on Compose can find other deployed agents and hand work to them. In swarm mode, an agent that receives a request it can’t fully handle alone will discover a peer, propose a plan, wait for your approval, then delegate subtasks. The delegated agents run as children of the original stream — you see everything in one event loop. This guide walks through the full swarm flow: enabling swarm mode, watching agent discovery, approving a plan, and tracking child agent execution.

1. Enable swarm mode

Switch the thread to swarm mode so the agent can delegate:

2. Send a task that needs delegation

Give the agent a task broad enough that it benefits from help:

3. Watch discovery and plan proposal

The agent searches for peers with agent_find and submits a plan. You see both in the stream:
The plan sits in awaiting_approval until you decide.

4. Approve the plan

Approve, reject, or request changes with sdk.agent.decide():
For changes_requested, include a feedback field — the agent revises and resubmits.

5. Run the plan and track child agents

Once approved, start execution and watch child agents do their work:

Child agent events

Each child event includes a runKey so you can route its output to the right UI panel if you’re rendering multiple agents side by side.

Delegation without a plan

Not every delegation needs a formal plan. An agent in swarm mode can also use swarm_delegate directly — it finds a peer with agent_find, then hands off a subtask and folds the result into its own response. You’ll see tool_start/tool_end events with toolName: "swarm_delegate" instead of plan events.

Switching back to solo

When you’re done with swarm work, switch back:

Next