promptgarden ๐ŸŒฑ
๐ŸŒ ES
Conceptโ—โ—โ—‹3 min ยท +40 XP

What Are Subagents?

A subagent is its own agent instance with its own context, sent out by a main agent to handle a subtask.

Core idea

Instead of doing a subtask itself, a main agent can delegate it to a subagent - a separate agent instance with its own, usually empty context, that gets exactly one task and reports back a result.

What subagents are good for

  • Parallel search: multiple subagents can search different parts of a codebase or different sources at the same time
  • Specialization: a subagent can be tailored to one specific job (e.g. only code review, only research)
  • Context hygiene: the subagent accumulates many intermediate steps in its own context - the main agent only gets the final result back, instead of the whole research trail filling its context window

The cost tradeoff

Subagents cost extra tokens - each one has its own startup and its own intermediate steps. Multiple parallel subagents can noticeably raise the cost of a run. The benefit (a clean main context, parallel work) has to justify that.

Example: Opus 4.8

Claude Opus 4.8 introduced "Dynamic Workflows" as a research preview in May 2026: Claude Code can orchestrate hundreds of parallel subagents - an example of how far subagent concepts have been pushed in current agent tools.

EXAMPLE

Conceptual example: a main agent gets the task 'find all uses of function X' and sends out three subagents that search different folders in parallel, instead of searching everything itself sequentially.

QUICK QUIZ

What's the main benefit of giving subtasks to subagents instead of the main agent itself?

SOURCES

RELATED TOPICS

What Is an AI Agent? (vs. a Chatbot) โ—โ—‹โ—‹The Agent Loop: Think โ†’ Act โ†’ Check โ†’ Repeat โ—โ—โ—‹Cost Control for AI Agents โ—โ—โ—‹