Sub-agents

Type
Concept
Published
2026-04-04
Aliases
agents, child agents
Brief definition

Child processes spawned by a main Claude Code agent to execute tasks in parallel while preserving the parent’s context window.

What it is

Sub-agents are separate Claude Code instances launched by a parent agent to handle specific tasks concurrently. Rather than processing all work sequentially in a single context window, the parent agent can delegate work to multiple child agents, each with their own context window, and collect the results. This is particularly valuable when you have independent tasks that would otherwise use up the parent’s token budget.

For example, if you’re analyzing a large codebase and need to examine three different modules in parallel, the parent agent could spawn three sub-agents—one for each module—rather than analyzing them one at a time. Each sub-agent maintains its own separate context window and can work independently. The parent then collects the results and synthesizes them. The parent’s context is preserved: it doesn’t get bloated with the work of analyzing all three modules.

Sub-agents follow a delegation pattern: the parent specifies what should be done (the task and any relevant files or constraints), the sub-agent completes the work, and the sub-agent reports back results. This allows the parent to focus on coordination and synthesis rather than getting bogged down in implementation details. It’s similar to how a manager might delegate assignments to team members and then review their work.

Why it matters

For developers working on large projects, sub-agents enable AI-assisted work that would otherwise be impractical. Analyzing a million-line codebase is computationally expensive and token-intensive; delegating chunks of that analysis to sub-agents makes it feasible. Teams can accomplish more work in less time and at lower cost.

In academic and research contexts, sub-agents demonstrate a scalable pattern for AI systems: rather than a single monolithic AI trying to do everything, you have a coordinator that delegates to specialists. This architectural approach is relevant to institutions studying how AI systems can be designed to be both more efficient and more modular. The ability to work in parallel while preserving each agent’s context is a key insight for managing large, complex problems responsibly.