Agents & tools

Subagent

Also called: sub-agent, child agent

A subagent is a separate agent that a main agent spawns to handle a scoped subtask, with its own fresh context. It does the work, returns a short result, and the noise of how it got there never touches the main conversation.

James Phoenix
Understanding Data Updated July 2, 2026

Sometimes the cleanest move for an agent is to delegate. A subagent is a second agent instance, launched by the first, given a narrow task and its own blank context. It runs its own loop, uses its own tools, and hands back only its conclusion. The parent carries on with that result and none of the intermediate mess.

Why spawn one at all

The point is almost always about protecting the main context window:

  • Isolation. A task like "search the whole codebase for every call site" can involve reading dozens of files. Done inline, that floods the main context. Done in a subagent, the parent only receives the tidy summary.
  • Parallelism. Independent subtasks can run as several subagents at once, each in its own window, then their results are combined.
  • Focus. A subagent starts fresh, so it is not distracted by the parent's long history. It sees only what it needs for its one job.

The tradeoff

Delegation is not free. The parent cannot see how the subagent reasoned, only what it returned, so a subagent that misunderstands its brief fails silently and hands back a confident but wrong answer. The skill is in the handoff: give the subagent a crisp task and enough context to do it, and treat its result as a report to sanity-check, not gospel.

Note
Subagents are a context-engineering tool as much as an orchestration one. The reason to use them is usually "keep the main window clean," not "the model cannot do this itself."

Related terms

Building with AI agents?

This dictionary is part of how I think about agentic engineering. If you want the same thinking applied to your codebase, that is what I do.

See how I can help