Claude CodeINTERMEDIATE
Claude Code Subagents: Built-in Agents, Delegation, and Context Management
Needs reviewLast verified August 12, 2026·4 min read
This guide explains subagents in Claude Code: specialized AI assistants that handle side tasks like codebase search or research in their own context window, returning only a summary to your main conversation. It covers why subagents preserve context and control costs, the built-in subagents (Explore, Plan, General-purpose, and helper agents), how model inheritance works for Explore, and the options for restricting or disabling subagent delegation through permissions and environment variables.
What subagents are
Subagents are specialized AI assistants that handle specific types of tasks in Claude Code. Use one when a side task would flood your main conversation with search results, logs, or file contents you won't reference again: the subagent does that work in its own context and returns only the summary.
Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions. When Claude encounters a task that matches a subagent's description, it delegates to that subagent, which works independently and returns results. If you keep spawning the same kind of worker with the same instructions, that's the signal to define a custom subagent.
Note that subagents work within a single session. Anthropic's docs point to separate features for other patterns: background agents for running many independent sessions in parallel, cross-session messaging for sessions that pass messages to each other, and agent teams for a coordinated team of sessions Claude spawns and supervises.
Why use subagents
According to the documentation, subagents help you:
- Preserve context by keeping exploration and implementation out of your main conversation
- Enforce constraints by limiting which tools a subagent can use
- Reuse configurations across projects with user-level subagents
- Specialize behavior with focused system prompts for specific domains
- Control costs by routing tasks to faster, cheaper models like Haiku
Claude uses each subagent's description to decide when to delegate. When you create a subagent, write a clear description so Claude knows when to use it.
Built-in subagents
Claude Code includes built-in subagents that Claude uses automatically when appropriate. Each inherits the parent conversation's permissions; most run with a restricted tool set.
One important detail: Explore and Plan skip your CLAUDE.md files and the parent session's git status to keep research fast and inexpensive. Every other built-in and custom subagent loads both.
Explore
A fast, read-only agent optimized for searching and analyzing codebases.
- Model: inherits from the main conversation, capped at Opus on the Claude API
- Tools: read-only tools; Write and Edit are denied
- Purpose: file discovery, code search, codebase exploration
As of v2.1.198, Explore inherits the main conversation's model instead of always running on Haiku. On the Claude API, the inherited model is capped at Opus: a main conversation on a higher tier runs Explore on Opus, and a main conversation on Sonnet or Haiku runs Explore on that same model. On other providers (such as Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry, or Claude Platform on AWS), Explore inherits the main conversation's model directly.
A user or project subagent named Explore overrides the built-in and keeps its own model field, so you can define one with model: haiku to keep exploration on a lower-cost model.
When invoking Explore, Claude specifies a thoroughness level: quick for targeted lookups, medium for balanced exploration, or very thorough for comprehensive analysis.
Plan
A research agent used during plan mode to gather context before presenting a plan.
- Model: inherits from the main conversation
- Tools: read-only tools; Write and Edit are denied
- Purpose: codebase research for planning
When you're in plan mode and Claude needs to understand your codebase, it delegates research to the Plan subagent so exploration output stays in a separate context window while the main conversation remains read-only.
General-purpose
A capable agent for complex, multi-step tasks that require both exploration and action.
- Model: inherits from the main conversation
- Tools: every tool available to subagents
- Purpose: complex research, multi-step operations, code modifications
Claude delegates to general-purpose when the task requires both exploration and modification, complex reasoning to interpret results, or multiple dependent steps.
Other helper agents
Claude Code includes additional helper agents that are typically invoked automatically:
| Agent | Model | When Claude uses it |
|---|
| claude | Inherits | When a task doesn't fit a more specialized agent. A catch-all with every tool available to subagents; also the default agent for a dispatched background session, which runs with your settings' permission mode rather than a parent conversation's |
| statusline-setup | Sonnet | When you run /statusline to configure your status line |
| claude-code-guide | Haiku | When you ask questions about Claude Code features |
Restricting built-in subagents
Built-in subagents are registered by default in interactive sessions. The documentation lists these ways to restrict them:
- To block a specific built-in type, add it to
permissions.deny.
- To prevent Claude from delegating to any subagent, deny the
Agent tool itself with permissions.deny.
- To remove only the built-in
Explore and Plan subagents, set CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS=1. Claude then reads and explores files directly instead of delegating. This requires Claude Code v2.1.198 or later.
The docs also reference non-interactive (headless) mode behavior in this context; consult the full official documentation for details on that mode.
claudedetails.com is an independent publication and is not affiliated with, endorsed by, or sponsored by Anthropic. "Claude" is a trademark of Anthropic, PBC, used here for identification purposes only. Product details can change — always confirm specifics on Anthropic's own site before making decisions based on this post.