Subagents & Delegation
A subagent is a fresh Claude session spawned by the parent agent to do a specific task. Spawned via the Agent tool with a description, prompt, and subagent_type. The subagent gets its own context window and returns a single message back to the parent.
Subagents are interns sent to a different room with a written task — they come back with one report. You can send three at once (parallel), but they don't know what's happening at HQ unless you write it down.
Subagents are useful for (a) protecting parent context — verbose research/exploration absorbed in the subagent, only the summary returns; (b) parallelizing — multiple subagents in one tool call run concurrently; (c) specialization — different subagent_types have different tool access (Explore is read-only, Plan focuses on design). The parent passes the full prompt cold — subagents don't see parent conversation. The result is the agent's final message, returned as the Agent tool's tool_result.
Subagent prompts must be self-contained — no 'continue what we were doing' since the subagent has zero context. Trust-but-verify: a subagent's summary describes intent, not necessarily what it did — when it writes code, check the diff. Subagent failure modes: hallucinating success, giving up early on hard tasks, infinite loops within their own context. Parent should give clear acceptance criteria ('report whether tests pass, paste output') and verify after. Subagents can spawn their own subagents (recursive), but each level adds latency and cost. Background mode lets the parent continue while the subagent runs — useful for independent long tasks.
Subagents are fresh Claude sessions I spawn from a parent agent for specific tasks. The pattern is delegation: 'go research X, report back in under 200 words.' Subagents protect the parent's context — verbose exploration absorbed in the child, only the summary returns. They also enable parallelism — three subagents in one tool call run concurrently. The catch is they have zero parent context, so prompts must be self-contained, and their summaries describe intent not necessarily reality, so I verify after.
Delegating without acceptance criteria. 'Look into the bug' produces a vague summary; 'reproduce the bug, paste the stack trace, identify the failing line' produces actionable output. Subagents need crisp prompts more than parents do because there's no follow-up turn.