✻Founding-member pricing: every lesson for $19/mo. The first 3 lessons are free. Start lesson 1 →
Unit 5 · Subagents & Parallel Work · Lesson 22 of 40

What Are Subagents?

Learn how Claude Code subagents work: separate context windows, delegation, returned summaries, the built-in Explore and Plan agents, and when to use them.

ACADEMY9 min+68 XP4-question quiz

🎯 By the end of this lesson you'll be able to

  • Explain how a subagent's context differs from the main session
  • Name the built-in subagents and what they do
  • Know when delegation helps and when it hurts
  • Invoke a subagent explicitly

A specialist with its own desk

When Claude hands a task to a subagent, that subagent starts with a fresh, separate context window. It gets its own instructions, its own set of tools and a brief from the main agent. It does the work (reading 80 files, running a long search) and returns only a summary. All that heavy reading never enters your main conversation.

▶Watch it runDelegating an investigation
Delegating an investigation

Your main context received a tidy three-item summary, not 46 files.

The built-in subagents

SubagentWhat it's for
ExploreRead-only codebase search. Claude passes a thoroughness level: quick, medium or very thorough.
PlanRead-only research while you're in plan mode
general-purposeMulti-step tasks that need both research and changes

Claude delegates to these automatically when it makes sense. You can also ask directly: "use a subagent to…"

What's in a subagent's context

A custom subagent's context includes:

  • its own system prompt (the body of its definition file),
  • CLAUDE.md and git status (Explore and Plan skip these to stay lean),
  • the full content of any skills listed in its definition,
  • the brief the main agent writes for it.

It does not see your whole conversation, so the brief has to be self-contained.

When delegation helps, and when it doesn't

◎Delegate or keep it in the main thread?pick the best fit
Search the whole repo for every use of a deprecated API.
Lots of reading, small answer. Ideal for a subagent.
A quick one-line fix in a file you're already discussing.
Delegation adds overhead and loses shared context.
Run the full test suite and summarize only the failures.
Verbose output stays isolated, and only the failures come back.
Iterating on a design together, back and forth.
Iteration needs shared context and low latency.
i
Subagents aren't smarter

A subagent uses the same kind of model, so it won't give a better answer. Its value is isolation (protecting context), specialization (focused instructions and tools) and parallelism. It costs extra tokens, so delegate when those benefits are real.

Invoking explicitly

  • In plain language: "Use the code-reviewer subagent to check my changes."
  • With an @-mention, which guarantees that agent runs: @agent-code-reviewer
  • For a whole session: claude --agent code-reviewer
⇄Flashcards4 cards

Check your understanding

?Lesson quiz10 XP per correct answer · +25 for a perfect score
QUESTION 1 OF 4

What returns to the main conversation when a subagent finishes?

Why: Only the summary comes back, which is the whole point of isolation.
QUESTION 2 OF 4

Which built-in subagent does read-only codebase search?

Why: Explore searches read-only at a thoroughness level Claude chooses.
QUESTION 3 OF 4

What's a bad reason to use a subagent?

Why: Subagents don't give better answers. They give isolation, focus and parallelism.
QUESTION 4 OF 4

Which @-mention guarantees a specific custom subagent runs?

Why: @agent-<name> forces that subagent.
0 / 4 correct
Academy lesson

Unlock lesson 22 and the next 18

You've finished the free lessons. Join the Academy for $19/month to unlock every lesson, quiz, terminal simulation and puzzle, plus the final exam and your certificate of completion.

  • All 40 lessons across 9 units
  • 165+ quiz questions
  • Final exam + certificate
  • New lessons as Claude Code evolves
  • XP, streaks and badges
  • Cancel anytime

Already a member? Log in to continue.

Key takeaways

  • Subagents run in separate context windows and return summaries.
  • Built-ins: Explore (search), Plan (plan-mode research), general-purpose.
  • Delegate heavy, self-contained work. Keep iterative work in the main thread.
  • The brief must stand alone, because subagents don't see your conversation.

Nice work. Lesson 22 done?

Mark it complete to earn +68 XP, keep your streak alive and unlock badges.

Written by Curtis Cornell from Anthropic's public Claude Code documentation. Last reviewed November 14, 2026. Claude Code changes fast; if something here differs from your version, the official docs win.

Start lesson 1 free →