Claude Code Background Sessions and Agent View: Run Many Agents at Once
Agent view (claude agents) lets you dispatch Claude Code sessions that keep running in the background, peek at them, answer their questions and attach when needed. How to start background sessions with --bg and /bg, the attach/logs/stop commands, background shell jobs, worktrees, and the limits on usage and idle sessions.
Running one Claude Code conversation at a time leaves you waiting. Background sessions let you dispatch several tasks, walk away, and come back when one needs you. Agent view is the screen that manages them.
Agent view is a research preview as of October 2026; shortcuts may change. Details from Anthropic's agent view docs.
Open agent view
claude agents
Sessions are grouped by state — Needs input, Working, Idle, Completed / Failed / Stopped. Type a prompt at the bottom and press Enter to start a new session; each prompt is its own session, so you can fan out work in parallel. Esc returns to your shell while everything keeps running.
Filter to one project with claude agents --cwd ~/projects/my-app.
Start background work from the shell
claude --bg "investigate the flaky SettingsChangeDetector test"
claude --bg --name flaky-fix "investigate the flaky SettingsChangeDetector test"
Move a session you already have to the background
/bg(or/background) — move the current conversation to the background, optionally with an instruction:/bg run the test suite and fix any failures.←on an empty prompt — background it and open agent view in one step./fork— copy the conversation into a new background session while the original keeps going.
Background shell commands, scheduled /loop tasks and workflows carry over. Run /tasks to see what's running in a session.
Check in without losing your place
In agent view:
| Key | Action |
|---|---|
Space |
Peek: latest output or the question it's waiting on — reply with Enter |
Enter / → |
Attach to the full conversation |
← on empty prompt, or /exit |
Detach (never stops the session) |
Ctrl+X |
Stop a session (again within 2s to delete) |
Ctrl+T |
Pin a session so it isn't stopped when idle |
Ctrl+F |
Find a session by name |
Manage sessions from the shell
claude attach flaky-fix # attach in this terminal
claude logs flaky-fix # recent output
claude stop flaky-fix # stop it (also: claude kill)
claude respawn flaky-fix # restart it
claude rm flaky-fix # remove from the list
claude agents --json # for scripts
Names can be partial.
Background shell jobs (no AI involved)
claude --bg --exec 'pytest -x'
or start an agent view prompt with !. The command runs in place of Claude — no model, no usage — and shows up as a row you can peek at. Its output is kept in memory and the row disappears about five minutes after it exits, so read results promptly.
Parallel work needs separate copies of the code
Several agents editing the same checkout will collide. Use worktrees so each session has its own working directory on its own branch. (Running Claude Code Agents in Parallel With Git Worktrees) Note that Claude-created worktrees are deleted with the session in agent view, so commit or push first.
The limits
- Usage multiplies. Ten agents in parallel use your plan roughly ten times as fast. (Claude Code Usage Limits)
- Sessions are local. They survive sleep but stop if the machine shuts down. Sessions working at shutdown show as failed; ones unseen for 48 hours show as stopped.
- Idle sessions get parked. A finished or waiting session left unattached for about an hour has its process stopped; the conversation stays on disk and resumes when you reply. Pin it to keep it alive.
- Rate limits still apply across all sessions.
A good workflow
- Plan the work into independent chunks (one feature, one bug, one refactor each).
- Dispatch each with
claude --bg --name ...in its own worktree. - Use agent view to answer questions as they come up.
- Review each branch as a pull request. (Review AI-Generated Pull Requests)
The summary
claude agentsopens agent view;--bg,/bgand←send work to the background.- Peek with Space, attach with Enter, stop with
claude stop. - Use worktrees for parallel edits, and remember usage scales with agent count.
EasySpawn runs Claude Code on a persistent server that doesn't sleep or shut down with your laptop, so background sessions keep working through the night. See how it works or join the waitlist.
Related: Claude Code Subagents · Resume a Claude Code Session · tmux for Long-Running Sessions · Claude Code From Your Phone
Keep reading
Claude Code Plugins: Install, Manage and Build Your Own
A Claude Code plugin bundles skills, subagents, hooks and MCP servers into one installable unit, distributed through marketplaces. How to install plugins and choose a scope, what an enabled plugin costs you in context, the official marketplace, sharing a team setup, and building your own with plugin.json.
Claude Code GitHub Actions: Set Up @claude on Issues and Pull Requests
How to set up the Claude Code GitHub Action so you can mention @claude on issues and PRs: quick setup with /install-github-app, manual setup, API key vs subscription token, interactive vs automation mode, scheduled runs, cost controls, and security.