Claude Code

Agents & subagents

Claude can delegate large or independent tasks to a subagent in its own context window, getting back only a summary, the main conversation stays compact.

6 min

An agent is a model with tools and its own context

An agent is not a special mode or a separate product, it is the combination of a model, the tools it can call, and the context it is working from. Every Claude Code session is already an agent: you, the model, and the tools (read, write, run) sharing a context window.

The main agent, the one you are talking to, handles the overall task. But some tasks are large enough, or independent enough, that handling them inside the main conversation is expensive or impractical. That is where subagents come in.

A subagent is a second agent that the main agent spawns to handle one specific piece of work. The main agent hands off a clearly scoped task, "explore this directory and summarise what each module does", and the subagent goes off and works through it in its own separate context window.

MAIN AGENTSUBAGENTTASK →← SUMMARY

Select a numbered hotspot to see what occupies that part of the diagram.

Why delegate at all?

Context isolation is the main reason. A large codebase exploration, reading dozens of files, following imports, mapping dependencies, can easily consume tens of thousands of tokens. If that exploration happened in the main conversation, it would crowd out the task you actually care about. The main agent's context window would be full of intermediate steps before the real work even began.

By delegating to a subagent, the heavy work happens in a separate context that is discarded when the task is done. Only the summary comes back. The main conversation stays compact and focused.

The second reason is parallelism. Independent tasks, "review these three modules separately and report back", can each go to their own subagent and run at the same time. Sequential handling of the same work in the main thread would take three times as long.

One thing to be clear about: what comes back is always a summary, not a transcript. The subagent's full chain of tool calls, intermediate reasoning, and file reads stays in its own context window, which is discarded when it finishes. The main agent sees only the result. This is by design, the whole point is to keep the main conversation uncluttered.

Question 1 of 4

Why does the main agent delegate a task to a subagent?

Answer choices for question 1