# Subagent

> Canonical: https://skillalmanac.com/glossary/subagent | Last verified: 2026-11-23 | Index status: not offered to search engines

A subagent is a separate AI worker that a main agent hands a task to. In Claude Code it runs in its own context window with its own instructions and tool access, and returns only a final summary.

Also called: subagents, sub-agent, sub-agents, Claude Code subagents, Claude subagent.

## In plain language

A subagent is a helper that the main assistant sends off with a single job, such as searching a large codebase or running tests and reading the long logs. It works in its own separate memory, called a context window, so the clutter it produces stays out of your main conversation and only its short report comes back. Think of a manager delegating research to an assistant who returns a one-page summary. The main limitation is that it starts without knowing your conversation, so the instruction must contain everything it needs. The cost is that its work counts toward your usage limits, as Anthropic's documentation notes.

## Technical definition

In Claude Code, a subagent is defined by a markdown file whose frontmatter sets fields such as name, description, tools (an allowlist), disallowedTools (a denylist), model and permissionMode, and whose body becomes its system prompt. Claude delegates automatically when a task matches the description, or you can name or @-mention the subagent. It starts with a fresh context window and does not see the parent conversation, except for a fork, which inherits it. Only the final report returns. By default subagents can spawn their own subagents up to three layers below the main conversation, a limit set by an environment variable.

## How it shows up when you use agents

In Claude Code you meet subagents in two ways: built-in ones Claude picks for itself, and ones you define in a folder of markdown files. When a task matches a subagent's description, Claude hands it over, the subagent works in its own [context window](/glossary/context-window), and one summary comes back. This keeps long search results and logs out of your main session, which is the main reason to use one. A subagent can also be limited to fewer tools than the main session, such as read-only access.

What breaks when it is misunderstood:

- **Missing context.** The subagent does not see your conversation, so a vague handoff produces a vague result. Write the brief as if for a stranger.
- **Unscoped tools.** If you leave out the tools list, the subagent inherits the main session's tools, so a "reviewer" may be able to edit files.
- **Cost.** Subagent requests count toward your usage limits, so splitting work into many is not free.

Next actions: start with the [Claude Code subagents guide](/learn/claude-code-subagents-guide), use [Subagent design](/skills/skill-almanac/subagent-design) to decide what to delegate, and keep interactive back-and-forth work in the main thread. For several agents coordinating, see [multi-agent system](/glossary/multi-agent-system).

## Common confusions

- **Subagent versus agent skill.** A subagent is a worker with its own context. An [agent skill](/glossary/agent-skill) is instructions loaded into whichever agent needs them.
- **Subagent versus multi-agent system.** A subagent is delegated to by a parent and reports back. A multi-agent system is the broader idea of several agents working together.
- **Myth.** A subagent remembers the main conversation. It starts fresh, except for a fork, which Anthropic's documentation says inherits the parent conversation.
- **Summary versus transcript.** Only the final report returns to the parent; the subagent's intermediate work stays in its own context.

## Worked examples in this catalogue

### [Claude Code Subagents: When to Delegate and How to Scope Tools](https://skillalmanac.com/learn/claude-code-subagents-guide)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: When a Claude Code subagent beats the main thread, how to write its definition file under .claude/agents/, and how to limit its tools with an allowlist.

Why it exercises the concept: It is the practical walk-through of this definition: a fresh context, a scoped tool list and a summary that returns to the main conversation.

### [subagent-design](https://skillalmanac.com/skills/skill-almanac/subagent-design)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Helps you decide what to delegate, then write subagent definitions and briefs that work without the conversation.

Why it exercises the concept: Because a subagent does not see your conversation, the quality of the brief decides the result. This skill targets that.

### [subagent-driven-development](https://skillalmanac.com/skills/obra/subagent-driven-development)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Executes a plan by handing independent tasks to separate subagents.

Why it exercises the concept: It shows subagents used for the purpose they exist for: splitting a plan into independent pieces, each worked on in its own context.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

```
/agents
```

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code's subagent management. Recent versions print a reminder about the agents folder; older versions open a wizard listing subagents.

Why it exercises the concept: It is where you check that a subagent you wrote is found and available.

## Related terms

- [AI agent](https://skillalmanac.com/glossary/ai-agent.md)
- [Agent harness](https://skillalmanac.com/glossary/agent-harness.md)
- [Context window](https://skillalmanac.com/glossary/context-window.md)
- [Multi-agent system](https://skillalmanac.com/glossary/multi-agent-system.md)
- [Agentic AI](https://skillalmanac.com/glossary/agentic-ai.md)
- [Tool calling (function calling)](https://skillalmanac.com/glossary/tool-calling.md)
- [Agent orchestration](https://skillalmanac.com/glossary/agent-orchestration.md)

## Sources

- [Create custom subagents](https://code.claude.com/docs/en/sub-agents), Anthropic (Claude Code Docs) (accessed 2026-11-23)
- [Building effective agents](https://www.anthropic.com/engineering/building-effective-agents), Anthropic (accessed 2026-11-23)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-23. [Glossary index](https://skillalmanac.com/glossary.md).
