Home / AI / Claude AI / Claude Code Subagents Explained: Parallel Tasks Done Right

Claude Code Subagents Explained: Parallel Tasks Done Right

Abstract visualization of parallel data streams representing Claude Code subagents working simultaneously

Claude Code can run more than one task at once through subagents — separate Claude instances that work on different parts of a job in parallel, each with its own context window, then report back to the main conversation. Once you understand when to use them, they turn Claude Code from a single-threaded assistant into something closer to a small team working through a task list at the same time.

What Is a Subagent?

A subagent is a separate instance of Claude, spawned by your main Claude Code session, given a specific task and its own context window to work in. It does its work independently — reading files, searching code, running commands — and then returns a summary to the main conversation, rather than flooding your main context with everything it looked at along the way.

The key benefit is context isolation. If you ask Claude Code to research three different parts of a large codebase, doing that research directly in your main conversation fills it with detail you don’t need kept around. Delegating each piece to a subagent keeps your main conversation focused on decisions and results, while the exploratory work happens somewhere else.

When to Use a Subagent

Subagents are worth reaching for when a task is genuinely independent of the rest of your conversation — something that can be handed off, completed, and reported back without needing back-and-forth. Good candidates:

  • Broad codebase research — “find every place this function is called” or “understand how authentication works in this repo” — tasks that involve reading a lot of code but produce a short, useful summary.
  • Independent, parallel work — reviewing three unrelated files, or checking three different hypotheses for a bug, where the tasks don’t depend on each other’s results.
  • Keeping the main context clean — anything exploratory where you want the answer, not the search process, taking up space in your conversation.

Subagents are usually the wrong choice for anything that needs tight back-and-forth with you, or a task so small that spawning a separate agent costs more time than it saves — a one-line fix doesn’t need delegation.

How to Use Subagents in Claude Code

You can ask Claude Code directly to delegate a task — a request like “use a subagent to research how the payment flow works in this codebase” is often enough for Claude to recognise it should spawn one. You can also run several in parallel by asking for multiple independent pieces of research at once; Claude Code will spawn separate subagents for each rather than working through them one at a time.

Results come back as a summary in your main conversation, keeping the detailed exploration out of your active context while still giving you the answer you needed.

A Realistic Example

Working on a bug that could be in one of three services, a developer asks Claude Code to investigate all three in parallel — one subagent per service, each reporting back whether it found anything relevant. Instead of one long sequential search through each service in turn, all three come back together, and the developer picks up the one that actually found the problem.

Limitations to Know

Subagents can’t share context with each other mid-task — each works in isolation and only reports back at the end, so they’re not suited to tasks that need coordination between them while running. They also add real cost, since each subagent is a separate Claude session consuming its own tokens, so reaching for one on a trivial task is usually a net loss rather than a saving.

Common Questions

Do subagents cost more than doing the work directly? Yes, in raw token terms — each subagent is a separate session with its own overhead. The saving is in your main conversation’s context staying clean and in wall-clock time when tasks run in parallel, not in raw token cost per task.

Can a subagent use a different model than the main session? This depends on your Claude Code configuration — some setups let you assign a faster, cheaper model to subagents doing simple lookups, reserving the more capable model for the main conversation where judgement matters most.

Next Steps

Next time you’re about to ask Claude Code to research something broad — “how does X work in this codebase,” “find every usage of Y” — try explicitly asking it to use a subagent, and notice how much cleaner your main conversation stays as a result.