ModelRefs / Subagent — AI Glossary
Subagent — AI Glossary
An agent invoked by a parent agent to execute a specific sub-task, returning its result as a tool call response. See also: agent-as-tool.
Overview
Subagents are the fundamental unit of agent composition. A parent orchestrator decomposes a goal and invokes subagents for specialized work (code execution, web research, data analysis). The subagent receives a narrowly scoped task, executes it with its own tools and context, and returns a structured result. See also: agent-as-tool.
Reference details
| Topic | agents |
|---|---|
| Last reviewed | 2026-06-24 |
Related terms
How it works
- The parent agent decomposes a goal and issues a subagent invocation as it would any tool call, with the sub-task described in the arguments.
- The subagent runs its own loop with its own context window, its own tool set and its own stopping conditions. The isolation is the point: its intermediate reasoning and raw tool output never enter the parent's context.
- The task description is the entire interface. A subagent cannot see the parent's conversation, so any constraint established earlier that the sub-task depends on has to be restated in the arguments or it is simply absent.
- The subagent returns a structured result, and the projection from its full working state down to that result is where the design work is. A result that returns everything defeats the isolation; one that returns too little forces the parent to re-ask.
- The parent receives the result as a tool message and continues reasoning, with no record of how it was produced — which is why subagent failures are hard to debug without the subagent's own trace retained out of band.
- Independent subagents can run concurrently, since they share no context; dependent ones serialise, and recognising which is which is the main source of latency wins.
Example: Where the context saving actually comes from
A research sub-task makes 10 tool calls, each returning about 2,000 tokens of raw output — 20,000 tokens of intermediate material. Inlined into the parent's conversation, that is 20,000 tokens the parent carries for the rest of the run, and it carries it on every subsequent request. Run as a subagent returning a 200-token summary, the parent pays 200: a factor of 100. Across 5 such sub-tasks the difference is 5 x 20,000 = 100,000 tokens against 5 x 200 = 1,000. Against a 200,000-token window, the inlined version has consumed 100,000 / 200,000 = 50% of the context before the parent has done any synthesis, while the subagent version has used 0.5%. The cost is what the 200 tokens leave out: if the parent later needs a detail that was in the discarded 19,800, it must re-invoke, and the second invocation does not know what the first found. That trade — context for recoverability — is the actual design decision, and it is made by choosing what the result contains.
Commonly confused with
A subagent is not a tool, although it is invoked like one. A tool is deterministic and its cost is bounded and known; a subagent runs a model loop, so its cost is variable, its output is non-deterministic, and it can fail in ways a function cannot — looping, misreading the task, or returning a confident summary of work it did not do. Treating a subagent as a tool leads to loops with no budget on the inner agent, which is how a bounded parent produces an unbounded bill. The related confusion is with multi-agent conversation: a subagent returns once to its caller, while conversational agents exchange messages and need a termination condition between them.
When to use it
Reach for it when:
- Sub-tasks that generate large volumes of intermediate output — search, file exploration, log analysis — where the parent needs the conclusion and not the material.
- Work needing a different tool set or permission scope, where isolation is a safety property rather than an efficiency one.
- Independent sub-tasks that can run concurrently, since separate contexts make parallelism straightforward.
- Specialised prompting, where a sub-task benefits from instructions that would conflict with the parent's.
Reach for something else when:
- Sub-tasks needing the full conversation. Everything relevant must be restated in the arguments, and an under-specified handoff is the usual cause of a subagent solving the wrong problem.
- Short tasks, where the invocation overhead and the extra model turn exceed the work.
- Tightly interdependent steps that need to see each other's intermediate state, which isolation prevents by construction.
- Without a budget on the subagent. A parent's stopping conditions do not bound a loop running inside its tool call.
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Subagent — AI Glossary.
Frequently asked questions
What is Subagent?
An agent invoked by a parent agent to execute a specific sub-task, returning its result as a tool call response.
What concepts are related to Subagent?
Closely related concepts include agent as tool, worker agent, orchestrator.