You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/multi-agent/index.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,50 @@ transfer_task(
45
45
46
46
</div>
47
47
48
+
## Parallel Delegation with Background Agents
49
+
50
+
`transfer_task` is **sequential** — the coordinator waits for the sub-agent to finish before continuing. When you need to fan out work to multiple agents at the same time, use the `background_agents` toolset instead.
51
+
52
+
Add it to your coordinator’s toolsets:
53
+
54
+
```yaml
55
+
agents:
56
+
root:
57
+
model: anthropic/claude-sonnet-4-0
58
+
description: Research coordinator
59
+
sub_agents: [researcher, analyst, writer]
60
+
toolsets:
61
+
- type: think
62
+
- type: background_agents
63
+
```
64
+
65
+
The coordinator can then:
66
+
67
+
1. **Dispatch** several tasks at once with `run_background_agent` — each returns a task ID immediately
68
+
2. **Monitor** progress with `list_background_agents` or `view_background_agent`
69
+
3. **Collect** results once tasks complete
70
+
4. **Cancel** tasks that are no longer needed with `stop_background_agent`
71
+
72
+
```bash
73
+
# Start two tasks in parallel
74
+
run_background_agent(agent="researcher", task="Find recent papers on LLM agents")
75
+
run_background_agent(agent="analyst", task="Analyze our current architecture")
<p><strong><code>transfer_task</code></strong> — simple, sequential delegation. Best when the coordinator needs the result before deciding what to do next.</p>
88
+
<p><strong><code>background_agents</code></strong> — parallel, async delegation. Best when multiple independent tasks can run simultaneously.</p>
Copy file name to clipboardExpand all lines: docs/configuration/tools/index.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,6 +180,31 @@ toolsets:
180
180
181
181
The `transfer_task` tool is automatically available when an agent has `sub_agents`. Allows delegating tasks to sub-agents. No configuration needed — it's enabled implicitly.
182
182
183
+
### Background Agents
184
+
185
+
Dispatch work to sub-agents concurrently and collect results asynchronously. Unlike `transfer_task` (which blocks until the sub-agent finishes), background agent tasks run in parallel — the orchestrator can start several tasks, do other work, and check on them later.
| `run_background_agent` | Start a sub-agent task in the background; returns a task ID immediately |
195
+
| `list_background_agents` | List all background tasks with their status and runtime |
196
+
| `view_background_agent` | View live output or final result of a task by ID |
197
+
| `stop_background_agent` | Cancel a running task by ID |
198
+
199
+
No configuration options. Requires the agent to have `sub_agents` configured so the background tasks have agents to dispatch to.
200
+
201
+
<div class="callout callout-tip">
202
+
<div class="callout-title">💡 Tip
203
+
</div>
204
+
<p>Use <code>background_agents</code> when your orchestrator needs to fan out work to multiple specialists in parallel — for example, researching several topics simultaneously or running independent code analyses side by side.</p>
205
+
206
+
</div>
207
+
183
208
### LSP (Language Server Protocol)
184
209
185
210
Connect to language servers for code intelligence: go-to-definition, find references, diagnostics, and more.
0 commit comments