A subagent is an agent assigned a bounded part of a larger task. A primary agent can delegate execution while retaining responsibility for the shared goal and final integration. This can provide fresh context or parallel work, but introduces coordination and debugging costs. section 2.4.3 section 8.5
In hierarchical delegation, the manager owns decomposition, dependencies, plan revision, acceptance, and the stop decision. Workers own local execution, declared writes, and evidence for their deliverables. Unlike fan-out/gather, where a coordinator merges comparable independent results, a hierarchy can manage dependent tasks and revise the plan as evidence changes. section 8.5
A delegation boundary needs a contract in both directions:
- Send the task, relevant goal and constraints, interfaces, dependencies, tool and write boundaries, expected artifact, and acceptance checks. section 8.5.1
- Return evidence and flag invalid assumptions, conflicts, missing dependencies, infeasible requests, or findings that change the plan. The manager reopens affected decisions; an independent reviewer or accountable human adjudicates challenges to the overall frame. section 8.5.1
- Enforce tool permissions in the runtime, not just in the role prompt. Instructions describe responsibility; configured access bounds action. section 8.5.2
Figure 8.4 Hierarchical Delegation gives the manager ownership of the evolving plan and integration, while workers own bounded execution and return evidence or exceptions.
The diagram separates manager-owned planning and integration from worker-owned execution and reporting. section 8.5
Context isolation can keep noisy search, test, or log output out of the main conversation. In Claude Code, a subagent receives a fresh context rather than the parent’s conversation and accumulated tool results; project memory normally still loads, although the built-in Explore and Plan agents skip it. Isolation also means discoveries do not automatically reach the manager or sibling agents: the return path must carry what they need. section 3.1.3 section 8.5
Delegating a coding task
A lead agent can commission requirements research, then implementation, then verification. If a worker finds an invalid assumption, it reports the affected decision and evidence so the lead can revise the plan. In Claude Code, the main dialog can choose a subagent configuration and integrate its result; custom configurations can specify role instructions, a model, and tool access. section 8.5 section 8.5.1 section 8.5.2
Add subagents when a measured single-agent limitation outweighs delegation overhead. Check task success, latency, token cost, and debugging effort; for a hierarchy, also track blocked tasks, plan revisions, returned invalid assumptions, and integration rework. Debugging may require reconstructing message flow, state ownership, and the order of partial results. section 2.4.3 section 8.5






