Subagent vs inline
What you'll learn
Spawn a subagent only when work is genuinely parallel or its intermediate context would pollute the parent. Otherwise, inline.
- Two and only two triggers: parallelism, isolation.
- Parallelism: independent work the parent can fan out.
- Isolation: intermediate context that shouldn't pollute the parent.
The decision to spawn a subagent versus continuing inline has exactly two valid triggers: (1) **parallelism** — the work decomposes into independent units the parent can fan out concurrently, and (2) **isolation** — the work's intermediate scratch (long traces, large outputs, exploratory dead-ends) would pollute the parent's context if it landed there. Anything else (cost, model size, 'feels cleaner') is not a structural reason to spawn.
Parallelism case: 'search 12 internal knowledge bases independently' or 'review 4 PRs concurrently'. Each unit is independent of the others; the parent fans out, each subagent does its work in its own context, the parent integrates the summaries. Sequential single-agent execution would be N× slower.
Isolation case: 'run 30 turns of exploratory debugging without polluting the parent's plan-then-execute thread'. The subagent's scratch (failed hypotheses, intermediate diffs, tool output) stays in its context; only the final summary lands in the parent's view. The parent stays focused on the high-level plan.
The non-reasons: 'subagents are cheaper' (they're not — each is its own model invocation chain), 'subagents have a longer context window' (no, they have a *fresh* one of the same size), 'subagent is required when more than N tools are registered' (no threshold rule). The exam tests these as distractors. Cost discipline matters in the other direction: each subagent is a token-heavy invocation; over-spawning trivially-sequential work burns budget for no benefit.
Key points
- Two and only two triggers: parallelism, isolation.
- Parallelism: independent work the parent can fan out.
- Isolation: intermediate context that shouldn't pollute the parent.
- Cost, window-size, tool-count are NOT triggers (and are common distractors).
- Over-spawning sequential work burns tokens without benefit.
Examples
'Search 12 KBs and cross-check facts.' Each KB search is independent (parallelism). Each subagent's tool-call trail and intermediate output stays in its own context (isolation). Parent integrates summaries. Latency drops, parent context stays clean.
'Add a one-line comment to a function.' Single short task, no parallelism, no isolation need. Subagent here is over-engineering — the spawn cost outweighs any benefit.
Pitfalls
- Spawning for 'cleanliness'. If neither parallelism nor isolation applies, inline is correct.
- Believing subagents have a bigger window. They have a fresh window of the same size.
- Falling for 'N-tool threshold' framing. There isn't one.
- Underbriefing subagents (covered in B8.2). Subagents have no memory of the parent conversation.
Source notes: 00-academy-basics/notes/06-claude-code-in-action.md
Ask Claude
Build a prompt with this lesson + your question, copy it, and open the Claude Project in a new tab.