Subagents
Why it matters
Subagents solve the main bottleneck of long agent tasks: the context window. Searching a codebase or reading twenty web pages can produce hundreds of thousands of tokens, most of which are irrelevant afterwards. If all of that lands in the main agent's context, quality drops (context rot) and costs rise. A subagent absorbs the mess and returns a few hundred tokens of conclusions.
They also allow parallel work. Deep research products, including those from Anthropic, OpenAI and Google, use a lead agent that sends out several search subagents at once. Coding agents like Claude Code use subagents for exploration, code review and test runs.
Deep Dive
A subagent is an agent that another agent starts in order to hand off a piece of work. The main agent, often called the orchestrator or lead, writes a brief describing the subtask. The subagent then works on it with its own fresh context window, its own tools and sometimes a different model, and sends back a short report. The lead never sees the subagent's intermediate steps, only the result.
Think of a lead researcher who asks three assistants to each read a different pile of documents and come back with a one-page summary. The lead stays focused on the big picture while the reading happens elsewhere.
Three Benefits
- Context isolation: each subagent starts clean and keeps its tool output out of the lead's context.
- Parallelism: independent subtasks run at the same time, cutting wall-clock time.
- Specialization: a subagent can have its own system prompt, a restricted set of tools or a cheaper, faster model for simple work.
The Costs
Subagents are not free. Anthropic reported that its multi-agent research system used about 15 times more tokens than a normal chat, while beating a single agent by roughly 90% on its internal research evaluation. That's worth it for valuable, broad questions and wasteful for simple ones.
The second cost is lost context. A subagent knows only what's in its brief. It doesn't know what the user said earlier, what has been ruled out or what the other subagents are doing. And the lead sees only the summary, not the evidence, so a subagent's mistake comes back sounding as confident as a correct finding.
The third is conflicting decisions. Cognition, the company behind Devin, argued in a widely read 2025 post titled "Don't Build Multi-Agents" that parallel agents writing parts of the same thing make incompatible choices, because each acts on assumptions the others can't see.
When They Fit
Subagents work best for tasks that are broad, read-heavy and separable: research, searching large codebases, reviewing many files, checking a result with fresh eyes. They fit poorly when subtasks are tightly coupled, as when several agents edit the same code, or when the task is small enough for one context. A common rule: parallelize the reading, keep the writing in one place.
Writing a Good Brief
The brief is the subagent's entire world, so write it like a handoff to a capable contractor:
- State the goal and why it matters, not just the action.
- Say what's already known or ruled out.
- Define the scope and when to stop.
- Specify the format of the answer, and ask for sources or file paths so the result can be checked.
Vague briefs are the most common failure. "Research the semiconductor shortage" sends three subagents off to run the same searches.
Subagents vs. Multi-Agent Systems
Subagents are one pattern within multi-agent systems: a hierarchy where one agent delegates and the workers don't talk to each other. Other patterns involve agents that negotiate, debate or collaborate as peers, sometimes across companies using protocols like A2A. The orchestrator-worker pattern is the most widely deployed because it's the easiest to reason about.