A subagent is an agent the main agent launches for a narrow task, like finding where a function is used. It starts with its own clean context window, works with its tools and hands back only the result, not everything it read. That way the main agent's context does not fill up with details.
🤖Main agent→📤Launches a subagent→🔎Works in its own context→📋Hands back the result
Put it to the test
A question from the app. Pick an answer.
You told the agent "leave payments alone". It launches a subagent. What must it pass on?
It starts with its own clean context. What you told the main agent does not reach it unless it is passed along.
It only knows what it receives. The task plus the rule that applies is enough, and its context stays free for the work.
That fills its context with things it does not need, which is exactly what a subagent is meant to avoid.
You ask a coding agent to rename a function. First it has to find where it is used: it opens 40 files and finds 6 calls. If it does that itself, those 40 files stay in its context window for the rest of the session. If a subagent does it, the main agent gets back a 6 line list.
It also lets work happen in parallel, with three subagents checking three folders at once, and lets one part of the job run under different rules: a reviewer that can only read, with no permission to edit, or with its own reviewer instructions.
What it costs
More tokens overall. Each subagent brings its own instructions and sometimes rereads files the main agent had already seen. What it saves is room in the main context, not money: three subagents in parallel usually spend quite a bit more than a single agent.
And it starts without knowing what the main agent knew. What you said in the chat does not reach it unless someone passes it along. So the request to the subagent has to be complete: the task, what is already known and the rules that apply. Choosing what to pass it is context engineering.
Subagent, skill and rules file
A skill adds instructions to the same agent, in the same context. A file like CLAUDE.md gives fixed rules to the whole session. A subagent is another agent, with a separate context, and of all the work it did, only its report comes back.
As of October 2026, Claude Code calls them that and lets you define your own, each with its instructions and its tools. Other tools have similar ideas under other names, and they change often: check the docs of the one you use.
Common mistakes
"More subagents is cheaper." It is faster in parallel, but it usually spends more tokens. "It knows what we talked about." It only knows what it receives. "If the subagent says so, it is verified." Its report is a summary: it can leave something out or be wrong, like any agent. For a small task, launching one costs more than it saves.