In Claude Code, subagents are specialized helpers that Claude delegates a task to. Each subagent runs in its own isolated context window -- its own separate workspace -- does the work on its own, and reports only the result back to your main conversation. Think of it as handing a well-scoped job to an assistant who goes off, gets it done, and comes back with the answer instead of narrating every step to you. You create and manage them with the /agents command.

What Claude Code subagents actually are

When you ask Claude to do something large, like search an entire codebase or research a self-contained question, all of that digging normally happens right in front of you, filling your conversation with search results and file contents you will never look at again. A subagent moves that work somewhere else. It gets a task, its own set of tools, and its own instructions, then works in a separate context and returns a short summary. Two things make this valuable: the main thread stays clean, and more than one subagent can run at the same time.

A quick definition: a "context window" is simply the working memory Claude has for a conversation. Giving a subagent its own context window means its research does not eat into -- or clutter -- yours.

The two big benefits

Almost every reason to reach for a subagent comes down to one of these two ideas.

Benefit 1Context isolationA big search or a noisy log dump happens in the subagent's own space. Your main conversation only sees the tidy summary, so it stays focused on the real task.
Benefit 2ParallelismSeveral subagents can run at once. Instead of researching three things one after another, Claude fans the work out and pulls the answers back together.

The built-in subagents

You do not have to build these from scratch. Claude Code ships with a few subagents it reaches for automatically, and each one has a clear job.

built-in subagents
ExploreA fast, read-only helper for searching and understanding a codebase. It cannot make changes.Read-only
PlanGathers context so Claude can propose a plan before doing any work. Also read-only.Read-only
General-purposeA capable helper for complex, multi-step jobs that need both research and action.All tools

Claude picks the right built-in subagent for the job automatically.

You can also define your own. A custom subagent is described by three things: a plain-English note about when to use it, a system prompt that tells it how to behave, and the set of tools it is allowed to touch. That last part is a real safety lever -- you can give a "reviewer" subagent read-only access so it can look but never change anything.

The point isn't to hand off the work and walk away. It's to keep the messy parts out of your main conversation so you stay focused on the decision that matters.

A real example

Say you are trying to understand how billing works across a large project before you change anything. On your own, you would open a dozen files and lose the thread. Instead you send that search to a subagent:

Use a subagent to find everywhere billing is calculated and summarize how it fits together

Hand a broad search to a subagent. Click to copy.

The Explore subagent reads through the code in its own space and comes back with a short, plain summary -- not a wall of file dumps. Your main conversation stays clean and ready for the actual work. And when you have several unrelated questions, Claude can fan them out to run at the same time:

claude
Research three things in parallel # subagent 1 map the billing code done # subagent 2 summarize the auth setup done # subagent 3 list the open TODOs done Three summaries returned, main thread stays clean

Three subagents run at once and report back separately.

Foreground, background, and staying in control

Subagents can run in the foreground, where you watch them finish before moving on, or in the background, where they work while you keep going with something else. Either way, a subagent only ever reports a result back to you -- it does not take over your conversation. One thing worth knowing: built-in subagents work within a single Claude Code session. If you want many fully independent sessions running side by side, that is a related but different feature.

When to reach for a subagent

Use one when a side task would otherwise flood your main conversation with results you will not reference again, or when you have several self-contained jobs that can run at once. A broad codebase search, a research question that stands on its own, or a "go read all of this and tell me the gist" task are the classic fits. If a job is small and its output is the thing you are actually working on, just ask Claude directly -- there is nothing to isolate.