Subagents
Mechanics (context isolation, what a subagent receives, tool restriction) are in subagent invocation and context passing. This note is the design decision.
Decision criteria (design guidance, built on verified mechanics)
Split into subagents when at least one holds:
| Reason | Why it justifies a subagent |
|---|---|
| Context isolation | Exploration would fill the main context; only the final message returns (verified) |
| Parallelism | Independent subtasks finish in the time of the slowest (verified) |
| Specialised instructions | A tailored system prompt would be noise in the main prompt (verified) |
| Permission or tool isolation | A reviewer limited to Read, Grep, Glob cannot modify files (verified) |
| Independence of judgement | A fresh reviewer is not anchored on the author's reasoning |
Do not split when the task fits one context, steps depend tightly on each other, or a direct grep answers the question. Anthropic's prompting guide warns that newer models can over-delegate and that Opus 5 delegates more readily than earlier models (verified).
Architecture patterns
- Orchestrator and workers: a coordinator plans and merges; workers are narrow and stateless between tasks.
- Parallel specialists: security, style, tests, performance reviewers run concurrently.
- Pipeline: output of one stage feeds the next (extract, validate, enrich); each stage can be a subagent with its own model tier.
- Explorer and executor: a cheap, read-only explorer feeds a stronger model that edits.
Controls an architect must set
- Depth (default 3 layers), concurrency (default 20), spend (
maxBudgetUsd); environment variables for the first two. Each subagent makes its own requests, all counted in spend. maxTurnsper subagent; partial output is marked and can be resumed.- Tool and model per subagent (
tools,model), for least privilege and cost tiering.
Design questions to answer in a review
- What does each subagent receive, and is that enough? (Only the prompt string crosses over.)
- What must it return, in what shape, with sources? (See provenance in information provenance.)
- What happens when one fails? (See error propagation, error propagation.)
- What is the cost ceiling and the observability plan? (D3.4)
Exam traps
- Subagents for everything because the model likes to delegate.
- No spend, depth or concurrency caps.
- Subagent prompts that assume shared memory.
- Same tools and model for every subagent.
References
- Subagents in the SDK — checked Oct 16, 2026
- Prompting best practices — checked Oct 16, 2026
Check your understanding
Three independent review checks on one change: architecture?Show answerHide answer
Answer
Parallel specialist subagents, merged by a coordinator.What stops a runaway delegation tree?Show answerHide answer
Answer
Depth, concurrency and spend caps.When is a subagent unjustified?Show answerHide answer
Answer
When one context suffices or a direct tool call answers it.