Multi-Agent Orchestration
Coordinator and subagents (hub and spoke)
- A coordinator (main agent) plans, delegates focused subtasks to subagents, and synthesises their results.
- Subagents do not talk to each other by default; everything flows through the coordinator. This keeps one place that owns the plan, error handling and the final answer.
- In the Agent SDK the coordinator delegates through the
Agenttool (older versions named itTask; match both when detecting calls).
Why delegate
- Context isolation: a subagent has its own conversation; its intermediate tool calls stay inside it and only its final message returns.
- Parallelism: independent subtasks run concurrently, so total time is the slowest one, not the sum.
- Specialised instructions: each subagent can carry its own system prompt.
- Tool restriction: a reviewer limited to read-only tools cannot modify files.
Parallel vs sequential (design guidance)
- Parallel when subtasks are independent (security review, style check and test coverage of the same change).
- Sequential when one result feeds the next (research, then analysis, then report).
Costs and limits
- Every subagent makes its own API requests; all count toward the query's spend.
- Subagents can spawn their own subagents, so one prompt can grow into a tree. Caps: depth (default 3 layers), concurrency (default 20 at once) and spend (
maxBudgetUsd/max_budget_usd), the first two set through environment variables. - Delegation is not free: only use multiple agents when isolation, parallelism or specialisation earns its cost.
Exam traps
- "More agents is better." A single agent with good tools is simpler, cheaper and easier to debug when the task fits in one context.
- Subagents sharing the coordinator's memory. They do not; see 1.3.
- Letting subagents talk freely to each other with no owner for the plan or failures.
- Old rule: "subagents cannot spawn subagents." Current docs say they can, with configurable caps. Check which version a question assumes.
References
- Subagents in the SDK — checked Oct 16, 2026
Check your understanding
Three independent code-review checks on one pull request: parallel or sequential?Show answerHide answer
Answer
Parallel.What returns from a subagent to the coordinator?Show answerHide answer
Answer
Its final message only, not its intermediate tool calls.How do you stop a runaway delegation tree?Show answerHide answer
Answer
Cap depth, concurrency and spend.