AI CompendiumA public chart of the language
Home / Agents & Harness / Subagent
Agents & Harness

Subagent

A helper agent with its own clean context window.

Definition

A separate agent invocation that the main agent delegates to. The subagent works in its own context and returns only a distilled result, keeping the parent’s window clean.

Subagents are context management disguised as delegation. Searching forty files and reporting three findings costs one paragraph of the parent’s context instead of forty files’ worth.

The reason to delegate is context isolation, not parallelism, and the isolation is what you are buying. A subagent absorbs a noisy search — twenty files, four dead ends — and returns two paragraphs. The parent context stays small and the quality of its subsequent decisions stays high.

How people use it
Splitting up a large investigation.
"Fan out a subagent per service and have each one report back three lines. Then we decide with a clean head."
Worked examples

The search that should not pollute the parent

Finding which of two hundred files implement an interface.

Delegate it. The subagent reads widely in its own window and returns the three file paths and a one-line summary. The parent never sees the twenty dead ends, which is precisely why its next decision is better.

Delegation has a coordination cost

Splitting a task across five subagents writing to the same codebase.

They duplicate work, make conflicting edits, and the parent now has to reconcile them. Delegation pays when the subtasks are genuinely independent and the return value is small. Otherwise a single well-resourced context is cheaper.

Sources
  • docsCreate custom subagents ↗Claude Code docs · 2026

    Specialist agents with their own context, tool restrictions and permission scoping — subagent delegation as a product feature.

  • blogHow we built our multi-agent research system ↗Anthropic Engineering · 2025

    Production account of a lead-agent plus subagents architecture, including when delegation helps and what the coordination costs are.

  • docsTools — Agents SDK ↗OpenAI Agents SDK docs · 2026

    The full tool taxonomy in one place: hosted tools, runtime tools, function tools, agents-as-tools, shell, computer use, and programmatic tool calling.

Related terms