An orchestrator agent needs to investigate 36 payment transactions, 24 invoices, and a 15-page contract. If it reads all of this directly, thousands of data points flood its context and degrade its ability to reason about the actual decision — whether to approve the billing dispute.
The fix: delegate each investigation to a sub-agent. The sub-agent absorbs the raw data in its own context, extracts what matters, and returns a compact summary. The orchestrator never sees the raw data. Its context stays clean for the thing it actually needs to do — synthesize and decide.
The Core Mechanism
Sub-agent delegation for context isolation works because each sub-agent gets its own independent context window. Raw data enters the sub-agent’s context, not the orchestrator’s. The orchestrator receives only the sub-agent’s return value — a structured summary that is a fraction of the original volume.
A controlled comparison makes this concrete:
| Configuration | Sub-agent output | Coordinator context | Final accuracy |
|---|---|---|---|
| Full output | Complete analyses (12-18 pages each) | 85% consumed | 68% |
| Summaries only | Structured findings (~10% of full) | 35% consumed | 92% |
Same agents, same tasks. The only variable is how much data crosses the sub-agent boundary. Summaries preserve 50 percentage points of context headroom and produce a 24-point accuracy improvement.
What Sub-Agents Should Return
The summary is the critical handoff point. Too verbose and you lose the isolation benefit. Too sparse and the orchestrator makes decisions on incomplete data.
Anti-pattern: dumping everything back. A sub-agent that returns complete file contents plus its full reasoning trace transfers all the raw data the delegation was meant to isolate. The orchestrator’s context fills exactly as it would have without delegation.
Anti-pattern: vague free-text summaries. A billing sub-agent finds a $50 credit on the account but its free-text summary says only “account in good standing.” The orchestrator never learns about the credit. In one system, free-text summaries caused 15% error rates — always on facts present in the sub-agent’s raw data but absent from the summary. The sub-agents retrieved correct information 98% of the time; the loss happened during summarization.
What works: structured output with required fields. A template that requires specific fields — amounts, dates, statuses, file paths, function signatures — ensures critical details survive the summarization step. The orchestrator gets exactly the data it needs, in a predictable format.
Good return formats:
- Categorized findings with the top 3-5 examples per category and exact file locations
- Structured JSON with key findings, confidence levels, and file pointers the orchestrator can use to re-read specific files if it needs more detail
- Per-issue rows with required columns (order ID, amount, status, resolution)
Delegation Granularity: Not Too Fine, Not Too Coarse
A 600-file security audit across 20 modules. How many sub-agents?
| Strategy | Sub-agents | Problem |
|---|---|---|
| One sub-agent for all 600 files | 1 | Same degradation as no delegation — 600 files overflow any single context |
| One sub-agent per file | 600 | Excessive coordination overhead; orchestrator must merge 600 individual summaries |
| One sub-agent per module | 20 | Each handles ~30 files comfortably; orchestrator merges 20 summaries for cross-module analysis |
The right granularity aligns sub-agent boundaries with logical units of the domain: services in a microservice project, investigation areas in a support case, sections in a long document.
For PR code review, the data shows the degradation curve clearly:
| PR size | Review quality (single-pass) |
|---|---|
| 1-15 files | 94% |
| 16-30 files | 71% |
| 31+ files | 52% |
Delegating each file’s review to an independent sub-agent that returns a focused finding summary eliminates this curve. The orchestrator compiles reviews without ever holding raw file contents.
For contract extraction, single-pass accuracy drops from 96% on early sections to 78% on later sections. Section-based delegation maintains consistent accuracy because each section gets a fresh, focused context.
The Orchestrator’s Job Changes
Without delegation, the orchestrator does everything: reads data, analyzes it, and makes decisions. With delegation, its role narrows to coordination and synthesis:
- Dispatch — assign scoped tasks to sub-agents with clear output requirements
- Receive — collect structured summaries from each sub-agent
- Synthesize — merge summaries, detect cross-cutting patterns, make decisions
This is why the orchestrator needs context headroom. At 85% consumed by raw sub-agent output, it cannot synthesize. At 35% consumed by summaries, it has ample space to reason about cross-module dependencies, detect patterns across investigation areas, or weigh competing evidence from multiple sources.
When Not to Delegate
Delegation adds latency and coordination complexity. It is not always necessary:
- Small inputs — three 200-word summaries from sub-agents total 600 words. Context capacity is not the bottleneck at this scale.
- Simple tasks — a single file read or a quick lookup does not need isolation.
- Tightly coupled analysis — when the analysis requires simultaneous access to all data (e.g., cross-referencing two specific paragraphs), splitting into sub-agents may lose the connections the analysis needs.
The threshold is contextual: delegate when the raw data volume would meaningfully degrade the orchestrator’s ability to do its coordination job.
Combining Delegation with Other Techniques
Sub-agent delegation pairs naturally with the scratchpad pattern. The orchestrator can write received summaries to a scratchpad file, making them immune to its own context degradation during later synthesis phases. If /compact is needed later, the scratchpad preserves the summaries that compaction might compress.
In Claude Code workflows, the Explore subagent serves this isolation role for codebase discovery. It explores files in its own context and returns a focused summary. Plan mode then provides the design-alignment phase between discovery and implementation — without plan mode, the developer risks the orchestrator jumping to implementation before confirming the approach is correct.
One-liner: Delegate data-heavy tasks to sub-agents that return structured summaries — the orchestrator’s context stays clean for the work only it can do: synthesize and decide.