Subagent

A subagent is a separate agent that a main agent spawns to handle a scoped task, returning only its result.

A subagent is an agent that another agent starts to do a focused piece of work, such as searching the codebase, reviewing a change, or running a self-contained task. It works in its own context window and returns only its result, which keeps large, noisy output out of the main session.

Claude Code ships built-in subagents, like Explore for read-only code search, and lets you define your own as Markdown files in .claude/agents/. A custom one carries a description that tells Claude when to delegate to it: a .claude/agents/test-writer.md, say, that only writes and runs tests. Each subagent sends its own requests, so it adds cost as well as focus; a clear, narrow brief is what makes one worth spawning.

Checked against Subagents, built-in and custom (.claude/agents/) (2026-10-23) .

All terms →