1673 words No Slides

Video 21.2: Built-in Subagents

Course: Claude Code - Parallel Agent Development | Section: 21. Subagents for Parallel Work | Length: 4 minutes | Presenter: Daniel Treasure


Opening Hook

Claude Code ships with four built-in subagents, and most of the parallel work you'll do comes from these four. They're pre-configured, optimized for specific jobs, and available instantly. In this video, you'll meet all four, understand what each one is best at, and learn when Claude automatically picks one versus when you should ask for it explicitly.


Key Talking Points

What to say:

The Four Built-in Subagents (Quick Tour)

  1. Explore Agent
  2. Model: Claude Haiku (fast, lightweight)
  3. Capabilities: Read, Glob, Grep (read-only tools only)
  4. Best for: Fast codebase searching, finding patterns, inventory work
  5. Speed: Fastest. Use when you just need to find things, not modify them
  6. Example: "Find all imports of the auth module" → Explore agent
  7. Limitation: Read-only, so no code generation or file changes

  8. Plan Agent

  9. Model: Inherited from main agent (Opus, Sonnet, etc.)
  10. Capabilities: All read-only tools (inherits your main agent's model)
  11. Best for: Safe analysis during planning phase, zero risk of modification
  12. Speed: Moderate. Good for detailed read-only analysis
  13. Example: "Analyze the architecture without proposing changes" → Plan agent
  14. Limitation: Can't make changes, can't use state-modifying tools

  15. General-Purpose Agent

  16. Model: Inherited from main agent
  17. Capabilities: All tools (everything your main agent can do)
  18. Best for: Complex multi-step tasks, coding, documentation, anything goes
  19. Speed: Slower (full model, full tools), but most capable
  20. Example: "Refactor this module and write tests for it" → General-Purpose
  21. Limitation: Most expensive per-invocation, use only when you need full power

  22. Bash Agent

  23. Model: Inherited from main agent
  24. Capabilities: Bash only (no file reads, no web access, just shell commands)
  25. Best for: Running commands, tests, builds, isolated execution
  26. Speed: Very fast for command execution
  27. Example: "Run the test suite" → Bash agent
  28. Limitation: Can only run commands, can't inspect code or make code decisions

When Claude Auto-Selects vs. When You Request Explicitly - Auto-selection: Claude often picks the right agent based on your request - "Search for all TODO comments" → Explore (obvious) - "Analyze the code" → Plan (safe analysis implied) - "Refactor this function" → General-Purpose (coding work) - Explicit request: You can override: "Use Explore agent specifically to..." or "Have Bash run this..." - Good practice: Let Claude auto-select for simple tasks, be explicit for critical or unusual work

Why This Matters - Explore and Bash are much cheaper than full models - Plan agent is safest for exploratory work (can't accidentally break things) - Understanding agent strengths helps you think about parallelization - You can run 5 Explore agents in parallel (fast, cheap) - Running 5 General-Purpose agents in parallel (expensive, save for real multi-step coordination)

What to show on screen:

  1. Agent comparison table on screen or whiteboard:
  2. Columns: Name, Model, Speed, Cost, Best Use Case
  3. Make it clear which is fastest and cheapest

  4. Explore agent in action: Demonstrate a fast codebase search

  5. Example: "Find all places where fetch() is called"
  6. Show the results come back in seconds
  7. Compare speed to manual searching

  8. Plan agent example: Analyze code safety without changes

  9. Example: "Review this auth module for security issues (read-only)"
  10. Show how it provides analysis but makes no modifications

  11. General-Purpose in action: Multi-step task

  12. Example: "Refactor this function to use async/await AND write unit tests"
  13. Show full tool access, more complex output

  14. Bash agent: Running commands

  15. Example: "Run npm test and show me the results"
  16. Show isolated execution, no file system access beyond what bash allows

  17. Speed/cost comparison: Side-by-side execution of the same task with different agents

  18. Show Explore finishing much faster than General-Purpose

Demo Plan

Setup (30 seconds): - Open Claude Code with a real project (TypeScript, Python, or JavaScript) - Have a terminal open to show Bash execution - Keep this video's previous note visible (decision tree from 21.1)

Explore Agent Demo (1 minute) 1. Say: "I want to find every place in this codebase where we're making HTTP requests." 2. Trigger the Explore agent (either auto or explicit) 3. Show it finding patterns with Grep across multiple files 4. Point out: "See how fast this returned? That's Haiku + read-only tools." 5. Mention: "If I wanted to see if these are all following our HTTP client wrapper, Explore can answer that."

Bash Agent Demo (1 minute) 1. Say: "Now I want to run the full test suite in isolation while I continue working." 2. Show invoking Bash agent with "npm test" or "pytest" 3. Show output streaming back 4. Mention: "Bash agent can't read my code, can't make decisions, just executes. Perfect for build/test workflows." 5. Optional: Show running two Bash agents in parallel (e.g., "lint in one, test in another")

General-Purpose Agent Demo (1 minute) 1. Say: "If I need something complex—like refactoring code AND writing tests AND updating docs—that's General-Purpose work." 2. Show a multi-step task being assigned to General-Purpose 3. Mention the cost difference vs. Explore/Bash 4. Conclusion: "All four agents have a job. Explore and Bash for fast, cheap parallel work. Plan for safe analysis. General-Purpose for heavy lifting."

Quick Tour of Auto-Selection (30 seconds) 1. Show that you can usually let Claude pick the agent 2. Point out cases where you might override (e.g., "explicitly use Explore here to keep it cheap") 3. Preview: Next video, we'll create our own custom agents beyond these four


Code Examples & Commands

Exploring Codebase with Explore Agent

# Natural language trigger (Claude picks Explore automatically)
"Find all database query calls in the codebase"

# Or explicit request
"Use the Explore agent to find every .env file in the project"

Running Tests with Bash Agent

# Natural language trigger (Claude picks Bash automatically)
"Run the full test suite and show me any failures"

# Explicit request for parallel execution
"Have Bash agent run npm test while I work on the refactor"

Safe Code Analysis with Plan Agent

# Trigger Plan agent for read-only analysis
"Use the Plan agent to review this authentication module for security issues"

# Auto-selection context
"Analyze the database schema—I just want to understand it, not change anything"

Complex Work with General-Purpose Agent

# Complex multi-step task
"Refactor this legacy service to use async/await, write unit tests, and update the README with the new API"

# Explicit request for control
"Use the General-Purpose agent to this: implement a caching layer, then optimize queries"

Mental Model for Selection

# Quick decision logic:
request = user_input

if "find" in request or "search" in request:
    agent = "Explore"  # Fast, cheap
elif "run" in request or "test" in request:
    agent = "Bash"     # Isolated, simple
elif "analyze" in request or "review" in request:
    agent = "Plan"     # Safe, read-only
else:
    agent = "General-Purpose"  # Fallback for complex work

Gotchas & Tips

Gotcha: "Bash agent can modify my files" - No. Bash is shell-only. It can't read code files unless the shell command does it. - It can create files via shell redirection, but not using Claude's file tools.

Gotcha: "Plan agent is just for the planning phase" - False. Plan is useful anytime you want read-only analysis. Use it mid-project to understand sections of code without risk.

Gotcha: "All built-in agents have the same speed" - False. Explore (Haiku) is noticeably faster than General-Purpose (full model). - Bash speed depends on what you're running, but CLI execution is very fast.

Tip: Parallelize Explore agents - Need to search 10 different patterns? Spawn 10 Explore agents in parallel. - Much cheaper and faster than sequential searching.

Tip: Use Bash for environment validation - "Check node version, npm version, and environment variables" → Bash agent - Great for pre-flight checks before complex operations

Tip: Combine agents in a pipeline - Example: Explore agent finds candidates, General-Purpose refactors them - This is different from Agent Teams—you're orchestrating sequentially, not parallel collaboration

Tip: Remember tool limitations - Explore can use Grep, Read, Glob (search/inspect) - Bash can only run shell commands - Plan can't modify anything - Know these before you ask


Lead-out

Now you know the four built-in subagents and when to reach for each one. But Claude Code also lets you create your own custom subagents tailored to your specific workflow. Want a code-reviewer agent that only uses certain tools? Or a documentation-generator that has a custom system prompt? In the next video, we'll learn how to create custom subagents from scratch using the /agents command.


Reference URLs


Prep Reading

  • Docs: "Built-in Subagents Reference" — understand each one's tool set
  • Benchmark: Run the same search with Explore vs. General-Purpose to see speed difference
  • Think about: What tasks in your workflow would benefit from Bash parallelization?
  • Review: Video 21.1 decision tree to prep for this comparison

Notes for Daniel

This video is about recognition and pattern-matching. Viewers should leave able to say, "Oh, this task sounds like an Explore job" or "That's definitely Bash work."

The comparison table/visual is critical. Without it, all four agents blur together. Make it visual, not just spoken.

Demo speed is important. Show Explore returning instantly. Show Bash executing in real-time. This reinforces why you'd use them.

Consider recording the built-in agent performance differences beforehand. A side-by-side stopwatch would be great.

Tone: You're introducing coworkers, not data. "Meet Explore—she's the fast search specialist" vs. "Explore uses Haiku + Grep/Read/Glob tools."

Mention upfront: "You don't need to create these. They're built in. Next video is about custom agents if you need something special."