What Are Agent Teams?
Agent Teams enable multiple Claude instances to collaborate on shared tasks, with one session acting as the lead coordinator and spawning teammates to work in parallel. This is an experimental feature built into Claude Code that AI Runner exposes through the--team flag.
Key characteristics:
- One lead agent coordinates the work
- Teammates are spawned as needed for parallel execution
- Coordination uses Claude Code’s internal task list and mailbox (not provider-specific)
- Works with all providers — AWS, Vertex, Ollama, Vercel, etc.
- Interactive mode only — not supported in shebang/piped script modes
Quick Start
How It Works
Agent Teams leverage Claude Code’s internal coordination system:- Lead Agent: The main session you interact with
- Task List: Shared work queue managed by the lead
- Mailbox: Inter-agent communication channel
- Teammates: Spawned workers that execute tasks and report back
Flags and Options
--team Flag
AI Runner flag that enables agent teams by setting the CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 environment variable.
--teammate-mode Flag
Claude Code native flag (passed through by AI Runner) that controls how teammates are displayed:
| Mode | Behavior |
|---|---|
auto | Automatic display (default) — Claude Code chooses based on environment |
in-process | Teammates share the same terminal output |
tmux | Each teammate gets its own tmux split pane |
--teammate-mode without --team has no effect (teammates aren’t spawned).
Limitations
Interactive Mode Only
Agent teams require an interactive session. Scripts (shebang/piped) run in single-agent mode:--team in a script, AI Runner shows a warning and disables it:
Token Scaling
Each teammate consumes tokens independently. Token usage scales roughly linearly with the number of active teammates:- 1 teammate active: ~1× normal token usage
- 3 teammates active: ~3× normal token usage
- 5 teammates active: ~5× normal token usage
- More teammates = faster completion but higher cost
- The lead agent spawns teammates as needed (not all at once)
- Simple tasks may not spawn teammates at all
Provider Compatibility
Agent teams work with all providers because coordination is internal to Claude Code:Use Cases
Parallel File Operations
Refactoring, migration, or analysis across multiple files:Complex Multi-Step Tasks
Tasks with independent subtasks:Large Codebase Analysis
Investigating patterns across many files:Saving Team Mode as Default
Use--set-default to persist your team configuration:
Troubleshooting
Teams Not Spawning
If you enable--team but don’t see teammates:
- Check mode: Teams only work in interactive sessions, not scripts
- Task complexity: Simple tasks may not need teammates
- Environment: Run
ai-statusto verifyCLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1is set
Tmux Mode Not Working
If--teammate-mode tmux doesn’t split panes:
- Tmux installed:
which tmuxshould return a path - Inside tmux: The flag only works when already in a tmux session
- Fallback: Claude Code falls back to
in-processif tmux unavailable
High Token Usage
If you’re seeing unexpectedly high token consumption:- Multiple teammates: Check how many teammates are active (scales linearly)
- Use smaller model for teammates: Override the small/fast model in
~/.ai-runner/secrets.sh: - Disable teams: Remove
--teamif parallel execution isn’t needed
Related Documentation
- Claude Code Agent Teams — Official Claude Code documentation
- Configuration — Model overrides and dual model system
- AI Command — Core interactive mode features