What Does Subagent Mean?
A subagent is a separate AI agent that a main agent starts to handle one focused piece of work, such as searching a codebase, reviewing a change or researching a question. The subagent gets its own fresh context window with just the instructions it needs, does the work using its own tools, and returns a short result to the main agent. Several subagents can run at once. Many coding agents support them, sometimes with predefined types that have their own instructions, tools and model choice. The main agent sees only the summary, not everything the subagent read.
Why Does Subagent Matter?
Subagents keep the main conversation clean. A search that reads fifty files would fill the main context with output the main agent mostly does not need; delegated to a subagent, it comes back as a few lines. The trade-off is that details can be lost in the handoff, and running many subagents uses more tokens in total, so they suit independent, well-defined tasks.
What Does Subagent Look Like in Practice?
You ask a coding agent to add input validation to every API route. It starts a subagent to find all route files and list how each one currently validates input. The subagent reads thirty files and returns a ten-line summary. The main agent then edits the routes with that summary in its context instead of thirty full files. If the summary missed a route, the main agent can ask for a follow-up search.
What Do People Get Wrong About Subagent?
Subagents do not automatically share what they learned. Unless the main agent passes details in the request, a subagent starts with no memory of the main conversation, and it only returns what it writes in its final report.
Which Terms Are Related?
- Agent loop: The repeated cycle of decide, act with a tool, observe the result, and decide again that makes an AI an agent.
- Agentic workflow: A setup where an AI takes multiple steps on its own, using tools and checking results, rather than giving one reply.
- Context window: The maximum amount of text, measured in tokens, that a model can take into account in a single request.
- Context engineering: Deciding what goes into a model context window, including instructions, files and tool output, so the model can do the task well.
All 28 terms are in the AI glossary. For models side by side, see frontier vs open-weight.
Frequently Asked Questions
Do subagents read my AGENTS.md or CLAUDE.md?
It depends on the tool. Some load the project instruction files for subagents too, others give them only the task prompt and their own definition. Check your agent documentation if a subagent ignores a project rule.
Are subagents more expensive?
Usually they use more tokens in total, because each one builds its own context. They can still save money and quality in long sessions by keeping the main context small.
When should I not use a subagent?
For small tasks you could do in a couple of steps, or when the work depends heavily on details from the main conversation that would be hard to pass along accurately.