Subagents: Delegating Subtasks to Specialised Helpers
Subagents: Delegating Subtasks to Specialised Helpers
~7 Min. Lesezeit Zuletzt aktualisiert am August 8, 2026
Beyond a certain project size, a single, continuous conversation runs into a practical limit: every file read, every intermediate thought, and every search result stays part of the conversation history, and therefore of the context window (more in chapter 22). Subagents solve exactly this problem: they carry out a clearly scoped subtask in their own, separate conversation and only report the result back at the end - the whole path to get there stays out of the main conversation.
What a subagent is
A subagent is essentially a second, specialised instance of Claude Code, started for a single task, working independently, and returning a summary to the main session afterwards. The main session doesn't see every single intermediate step the subagent takes, only the finished result - similar to asking a colleague to do some research and only getting the summary back, instead of following every single search along the way.
Why this saves context
Imagine asking Claude Code in the recipe planner project: "Search the whole frontend for old, unused CSS classes." That research can involve reading many files and many intermediate steps. If it runs directly in the main session, the context window fills up with intermediate results that aren't even relevant to the actual feature work anymore. If that same research runs in a subagent instead, only the finished list of unused classes found remains in the main session.
Typical use cases for subagents
- Research: "Find every place in the project that currently works directly with the file system."
- Code review: a second, independent look at a change before it's accepted - a kind of second opinion.
- Scoped subtasks: "Write additional tests for the category validation from the last chapter, while I work on the frontend."
Assigning a subagent a task
In the simplest case, it's enough to phrase a request accordingly, for example:
> Have a subagent independently review the tests in tests/recipes.test.js and check whether important cases are missing - without changing any code itself. Only summarise what's missing at the end.The slash command /agents from chapter 16 also lets you set up and reuse your own, specialised subagents with a fixed area of responsibility - for example a subagent solely responsible for code reviews in the recipe planner.
Tipp: Subagents are especially suited for tasks where the result matters, not the path to get there. For a task where you want to see every intermediate step yourself and possibly step in, the normal main session remains the better choice.
Subagents help keep the context clean. The next chapter covers a different kind of extension: MCP servers, which give Claude Code access to external tools and data sources it wouldn't otherwise know about at all.