Hero Image full

Subagent

7 min read
Content

What Is Subagent?

A subagent is a child agent that a lead agent spawns to handle one scoped task in a separate context window. It receives a brief, works independently with its own tools and instructions, and returns only its result. The parent keeps its own context clean while the subagent absorbs the exploratory noise. Anthropic's research system is built on this idea, spinning up 3 to 5 subagents in parallel, each in its own context window, to work a complex query [1].

Key Takeaways

  • The core benefit is context isolation. A subagent can read fifty files and run twenty commands, and the parent receives a three-paragraph answer instead of all that raw material.
  • A subagent only knows what its brief contains. It does not inherit the parent's conversation, so vague delegation produces confident answers to the wrong question.
  • Subagents can carry different permissions, models, and instructions than their parent, which makes them a natural unit for least-privilege design and cost control.
  • They fit tasks with a clear deliverable. Open-ended collaboration across many turns is the parent's job; a subagent shines on "go find out X and report back."

How It Works

When a lead agent decides a piece of work deserves delegation, it spawns a subagent with a task description. The platform starts a fresh agent instance: new context window, a role prompt, and whatever tool access the configuration grants. Project-level instruction files such as CLAUDE.md or AGENTS.md typically still load, so the child knows the codebase conventions even though it never saw the parent's conversation. The subagent then runs its own loop, reasoning and using tool calling until the task is done, and hands back a final report. The parent reads that report and moves on.

This mechanism is what makes hierarchical agent orchestration practical. Long tasks exhaust a single context window; delegating research, audits, and verification to subagents means the expensive parent context holds only decisions and results. It also enables parallelism, since a parent can dispatch several subagents at once and collect their reports as they finish. In Anthropic's system, running subagents in parallel with parallel tool calling cut research time by up to 90% for complex queries [2]. Modern AI coding agent platforms expose this directly: Claude Code has its Task tool and named agent definitions, and other frameworks offer equivalent spawn-and-report primitives.

Configuration is where teams get leverage. A subagent defined for code review might run a cheaper model with read-only file access, while a migration worker gets write access but a tight directory scope. Because each child's permissions are declared separately, subagents double as AI guardrails: the exploratory agent that touches untrusted web content can be denied the credentials the parent holds.

Example

An engineer asks a coding agent to remove a deprecated feature flag from a large codebase. The lead agent spawns three subagents in parallel: one searches the backend for every read of the flag and classifies each call site, one does the same for the frontend, and one checks infrastructure code and dashboards for references. Each child reads dozens of files, but each returns only a structured list of locations with a recommended edit. The parent, whose context now holds three tidy reports instead of a few hundred file excerpts, plans the removal, makes the edits itself, and spawns one final subagent to run the test suite and summarize failures. The whole task completes inside one parent session that would have overflowed twice without delegation.

What People Get Wrong

The persistent misconception is that a subagent shares the parent's knowledge. Engineers write briefs like "fix the issue we discussed" and are surprised when the child invents its own interpretation, because the child never saw the discussion. Everything the subagent needs must travel in the brief: the goal, the relevant paths, constraints, and the expected output format. Teams that treat the brief as a miniature spec get reliable delegation; teams that treat it as a chat message get plausible work on the wrong problem, and the error often surfaces only after the parent has built on top of it.

FAQ

When should an agent spawn subagents instead of doing the work itself? When the work would flood the parent's context with material that has no lasting value (broad searches, log analysis, large-file reads), when independent pieces can run in parallel, or when the task needs different permissions or a different model. For small, sequential edits, delegation adds overhead without benefit. When the fit is right the gains are large: a lead agent delegating to Claude Sonnet 4 subagents beat single-agent Claude Opus 4 by 90.2% on Anthropic's internal research eval, at a cost of about 15x the tokens of a chat interaction [3].

Do subagents talk to each other? Usually not directly. In most implementations each child reports to the parent, and the parent relays whatever context the next task needs. Peer-to-peer designs exist in a broader multi-agent system, but the parent-mediated pattern is easier to trace and debug.

How is a subagent different from just calling a tool? A tool call executes one fixed operation. A subagent runs a full agentic loop, choosing its own sequence of tool calls to satisfy a goal. The practical line: use a tool when you know the operation, use a subagent when you only know the outcome you want.

Sources

  1. Anthropic. "Research system spins up 3-5 subagents in parallel, each in its own context window." https://www.anthropic.com/engineering/built-multi-agent-research-system. Accessed August 2026.
  2. Anthropic. "Parallel subagents and parallel tool calling cut research time by up to 90% for complex queries." https://www.anthropic.com/engineering/built-multi-agent-research-system. Accessed August 2026.
  3. Anthropic. "Lead agent with Claude Sonnet 4 subagents outperformed single-agent Claude Opus 4 by 90.2%, using about 15x the tokens of chat." https://www.anthropic.com/engineering/built-multi-agent-research-system. Accessed August 2026.
Glossary pages

Related terms

No items found.
Internal links

Related Topics

No items found.
Let’s get in touch

Ready to build your product?

Book a consultation call to get a free No-Code assessment and scope estimation for your project.
Book a consultation call to get a free No-Code assessment and scope estimation for your project.