Build This Now
Build This Now
What Is Claude Code?Claude Code InstallationClaude Code Native InstallerYour First Claude Code Project
Agent FundamentalsBackground Agents in Claude CodeSub-Agent RoutingSub-Agent Design in Claude CodeClaude Code Task DistributionBuilder-Validator Agent TeamsClaude Code Agent TeamsAgent Teams ControlsAgent Teams Prompt TemplatesAgent Teams Best PracticesAgent Teams WorkflowCustom AgentsAgent PatternsHuman-like Agents
Get Build This Now
speedy_devvkoen_salo
Blog/Handbook/Agents/Background Agents in Claude Code

Background Agents in Claude Code

Push sub-agents to the background with Ctrl+B and keep working while they run.

Problem: A sub-agent used to freeze your session. The main agent would spawn it for research or a heavy analysis pass, and you had to sit there until it came back.

Quick Win: Hit Ctrl+B the moment a sub-agent starts, and it drops to the background:

You: Research authentication best practices for our Next.js app
Claude: I'll spawn a sub-agent to research this...
[Sub-agent starts]
You: [Press Ctrl+B]
You: While that runs, let's work on the database schema...

You stay in the chat. The sub-agent keeps working on its own. When it finishes, the results pop back in.

True Parallel Execution

Async sub-agents are now a first-class feature. Any time the main agent spawns one, you can push it to the background and pick up a different thread of work with Claude.

The flow:

  1. Request: Hand Claude a task that fits a sub-agent.
  2. Claude spawns: The main agent creates a sub-agent to run it.
  3. Background it: Press Ctrl+B while the sub-agent is still working.
  4. Keep going: Talk to the main agent about anything else.
  5. Auto-resume: On completion, the sub-agent wakes the main agent and drops off its results.

Want to see what's running? Type /tasks:

/tasks

Each background agent shows up with a status, a token count, and a progress indicator. Click one to dig into the details.

When to Background an Agent

Great candidates:

  • Research that needs web searches
  • Code analysis across large codebases
  • Documentation generation
  • Security audits and vulnerability scans
  • Performance profiling reports

Keep these up front:

  • Anything that needs your answer next
  • File edits you want to eyeball before they land
  • Work that depends on what you're doing right now

Shell Commands Too

The same trick covers slow shell commands. If Claude kicks off npm install, docker build, or an ffmpeg job, push it back:

Claude: Running npm install...
[Command starts]
You: [Press Ctrl+B]
You: While that installs, can you review the API routes?

Check on it with /tasks, just like you would with an agent.

The --agent Flag

A new CLI flag starts Claude Code already wearing a sub-agent's hat:

claude --agent plan

That line boots Claude with the planning agent's config loaded. You can prompt it, poke at its behavior, and see how it handles edge cases before you wire it into a real workflow.

When it helps:

  • Debugging a custom sub-agent before you rely on it
  • Checking an agent's instructions and tool access
  • Running a specialist directly for a one-off job
  • Learning what the built-ins actually do

Built-in agents work (plan, explore, and the rest), and so does anything you've defined in .claude/agents/.

Shipped Alongside

Anthropic bundled several other upgrades into the same release.

Instant compaction: /compact no longer makes you wait. Claude keeps a live session summary in the background, so the command just loads that summary into a clean context.

Session memory architecture: Every session now carries a structured summary. It tracks status, finished work, discussion threads, and a work log.

Stats dashboard: /stats shows your usage patterns, favourite models, token totals, and streaks. Hit Ctrl+S to copy the output for sharing.

Session naming: /rename labels a session, and claude --resume session-name brings it back by name. The /resume screen now groups forked sessions and has keyboard shortcuts too (P to preview, R to rename, B to browse forks).

MCP quick toggle: Flip MCP servers on or off without touching the config file.

Slack integration: Hand tasks to Claude Code from a Slack channel. Tag @Claude on a bug or a feature request, and the team workflow picks it up.

Common Issues

The agent won't background: Ctrl+B only works while the agent is actually running. Hit it during the work, not after it finishes.

You lost track of your agents: Run /tasks. It lists every background process with an ID.

Agent finished but nothing surfaced: Results usually come back through AgentOutputTool on their own. If you missed one, find it in /tasks and grab the output from there.

Next Steps

  • Execution patterns: Parallel, sequential, background. Pick the right one for the job.
  • Foundation: Read the agent fundamentals before you build anything bigger.
  • Design patterns: Sub-agent design covers how to split work cleanly.
  • Distribution: Task distribution handles multi-agent orchestration.
  • Custom agents: Custom agent patterns show how to build your own specialists.

Backgrounding turns Claude Code into something closer to a parallel workstation than a turn-based chat. Start a research pass. Keep shipping code. Pick up the results when they're ready.

More in this guide

  • Agent Fundamentals
    Five ways to build specialized agents in Claude Code, from sub-agents to .claude/agents/ definitions to perspective prompts.
  • Agent Patterns
    Orchestrator, fan-out, validation chain, specialist routing, progressive refinement, and watchdog. Six ways to wire sub-agents in Claude Code.
  • Agent Teams Best Practices
    Battle-tested patterns for Claude Code agent teams. Troubleshooting, limitations, plan mode quirks, and fixes shipped from v2.1.33 through v2.1.45.
  • Agent Teams Controls
    Stop your agent team lead from grabbing implementation work. Configure delegate mode, plan approval, hooks, and CLAUDE.md for teams.
  • Agent Teams Prompt Templates
    Ten tested Agent Teams prompts for Claude Code. Code review, debugging, feature builds, architecture calls, and campaign research. Paste and go.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now

Agent Fundamentals

Five ways to build specialized agents in Claude Code, from sub-agents to .claude/agents/ definitions to perspective prompts.

Sub-Agent Routing

Rules your main Claude Code thread can read to pick the right execution mode for every sub-agent it spawns.

On this page

True Parallel Execution
When to Background an Agent
Shell Commands Too
The --agent Flag
Shipped Alongside
Common Issues
Next Steps

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now