Course contents
Concept

Subagents and the Agent Tool

When to delegate to a subagent vs do it inline. Context budgets explained.

A subagent is a fresh Claude session the main agent spawns to do a specific task. It has its own context window — so it can read 50 files without polluting your main thread. When it finishes, it returns a summary, not the raw work.

Use subagents for: open-ended research ('find every place that uses our deprecated API'), large lookups, or work where the findings matter more than the steps. Don't use them for tasks where you need the main agent to keep that context — refactors, debugging, anything stateful.

The trap: subagents are expensive. If you fire three in parallel for a task you could do inline, you've burned tokens for nothing. The rule of thumb: would I want to read all the intermediate output? If no, delegate.

You can also define named subagents — a markdown file under .claude/agents/ with its own system prompt and tool allowlist — and Claude routes matching work to them automatically. /agents lists what's available. A read-only code-reviewer is the classic first one to write.

Check your understanding
Q1. When is a subagent the right call?
Q2. What does a subagent return to the main agent?
· Score 100% on the quiz.