# How to orchestrate coding agents: 5 ways, from subagents to cloud VMs

There are five practical ways to get several coding agents working at once: subagents inside one session, Claude Code agent teams, parallel sessions in git worktrees, a provider's cloud such as Codex cloud, and an orchestration platform. This guide shows how to set up each one and when it is the right choice.

- Canonical: https://replicas.dev/resources/how-to-orchestrate-coding-agents
- Start a free trial: https://app.replicas.dev/auth?mode=signup
- What is an AI agent orchestrator?: https://replicas.dev/resources/ai-agent-orchestrators

## Five ways to orchestrate coding agents

The options differ in where the agents run and how isolated they are from each other. Isolation decides how many agents you can run before they start overwriting files, fighting over ports, or overwhelming your review queue. Checked October 7, 2026 against vendor documentation. Replicas publishes this guide and is one of the options.

| Way | Where agents run | Isolation | Best for |
| --- | --- | --- | --- |
| Subagents | Inside one Claude Code or Codex session | Own context window; optional worktree | Research, review, and side tasks inside one job |
| Agent teams | Several Claude Code instances on one machine | Own context windows and a shared task list | Problems that benefit from teammates debating or owning separate pieces |
| Git worktrees | Several sessions on your machine | A separate checkout and branch per session | A few independent tasks you steer yourself |
| Provider cloud | A vendor-managed VM or container per task | A separate machine per task | Handing off tasks to one vendor's agent |
| Orchestration platform | A managed VM per task, across agents | A separate machine and environment per task | Team backlogs started from team tools, with a choice of agent |

## Subagents: delegate inside one session

Subagents are the lightest form of orchestration. The main session hands a focused task to a helper with its own context window, and only the result comes back, so searches and logs do not fill the main conversation.

### Subagents in Claude Code

Source: https://code.claude.com/docs/en/sub-agents

Ask for it in plain language, for example "use subagents to investigate how auth and billing each handle sessions". To make a reusable worker, save a Markdown file in .claude/agents/ with name, description, tools, and model in the frontmatter and the instructions below it. Claude delegates to it when a task matches the description, or when you ask for it by name.

Add isolation: worktree to the frontmatter for workers that edit code, so each one gets a temporary worktree instead of sharing your checkout.

- By default, up to 20 subagents run at once and they can nest three levels deep.
- Every subagent request counts toward your usage limits.

### Subagents in Codex

Source: https://learn.chatgpt.com/docs/agent-configuration/subagents

Current Codex releases enable subagents by default. Prompt with "spawn one agent per point" or "delegate this work in parallel", and Codex collects the results into one response. Built-in agents are default, worker, and explorer; custom agents are TOML files in .codex/agents/ with a name, description, and developer_instructions. Subagents inherit your sandbox and approval settings.

## Agent teams: let Claude Code coordinate teammates

Agent teams are an experimental Claude Code feature. Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to 1 in your environment or in the env block of settings.json, then describe the team you want, for example "spawn three teammates to review PR 142: one for security, one for performance, one for test coverage".

The lead session creates a shared task list, teammates claim tasks and message each other directly, and the lead combines the findings. Teammates run inside your terminal by default; set teammateMode to tmux to give each one its own pane.

- Start with three to five teammates and give each one its own files, since two teammates editing the same file overwrite each other.
- Teammates do not inherit the lead's conversation, so put the context they need in the spawn prompt.
- Known limits: /resume does not restore in-process teammates, a session has one team, teammates cannot start their own teams, and token use grows with every teammate.

## Git worktrees and tmux: run parallel sessions yourself

A git worktree is a second working directory with its own branch that shares the repository's history. Running each agent session in its own worktree means one session can build a feature while another fixes a bug without touching the same files. This works with any agent: Claude Code, Codex, OpenCode, Cline, or a mix.

Claude Code creates worktrees for you. Run claude --worktree feature-auth to start a session in .claude/worktrees/feature-auth on a new branch named worktree-feature-auth, then run it again with another name in a second terminal. Add .claude/worktrees/ to .gitignore, and list files such as .env in a .worktreeinclude file so they are copied into each new worktree.

For other agents, create the worktree with git: git worktree add ../app-feature-a -b feature-a. Then start the agent there in a detached tmux session, for example tmux new-session -d -s feature-a -c ../app-feature-a codex, and attach with tmux attach -t feature-a when you want to check in.

- Worktrees isolate files, not runtimes. Two dev servers on the same port, a shared local database, or two test suites competing for CPU still collide.
- Each worktree is a fresh checkout, so it needs its own dependency install.
- Your machine has to stay on, and you review and merge every branch yourself. Remove finished worktrees with git worktree remove.

## Provider clouds: hand tasks to one vendor's machines

Each major coding agent now has a hosted mode that runs every task on its own machine and returns a branch or pull request. You can start several at once and close your laptop. Each runs only its own agent, with its own environment settings and task list.

### Claude Code cloud sessions

Source: https://code.claude.com/docs/en/claude-code-on-the-web

Each claude --cloud "task" command, or each task started at claude.ai/code, runs in its own Anthropic-managed VM, so several commands in a row run in parallel. Sessions need a GitHub repository and count toward your Claude plan's limits. Agent teams can be turned on in a cloud environment's variables.

### Codex cloud

Source: https://learn.chatgpt.com/docs/environments/cloud-environment

Codex cloud runs each task in an OpenAI-managed container built from an environment you configure once, with a setup script and internet access off by default while the agent works. Tasks start from chatgpt.com/codex, the IDE, the CLI, GitHub, GitLab, Linear, or Slack.

### Cursor Cloud Agents and GitHub Copilot

Source: https://cursor.com/docs/cloud-agent

Cursor Cloud Agents run in isolated VMs and start from the editor, web, mobile, Slack, GitHub, Linear, or an API. GitHub Copilot's cloud agent takes assigned issues and works in GitHub Actions environments. Both return a branch and pull request.

## An orchestration platform: one queue for every agent

A platform takes over the parts you would otherwise script yourself: the queue, the environment, the trigger, and the review loop. Replicas runs each task in its own Linux VM prepared from an environment your team defines once, and lets you pick Claude Code, Codex, Cursor, OpenCode, or another supported agent per task. Tasks start from Slack, Linear, GitHub, GitLab, schedules, webhooks, failed CI runs, or the API.

Because every task has its own machine, runtimes do not collide: each agent can start services, run the full test suite, and use a desktop browser. Reviewers can watch a session, take over, comment on the diff, and have the agent continue in the same workspace. Devin and Factory also orchestrate at this level, each around its own agent. The agent orchestration platforms guide compares them in detail.

## Which way should you start with?

Start with the lightest option that covers the work, and move up when isolation, triggers, or review start to hurt. The options combine: an agent running in a Replicas workspace or a cloud session can still delegate to its own subagents.

- **You need research or a second opinion inside one task:** Subagents.
- **One hard problem would benefit from several perspectives:** Agent teams, starting with research or review rather than parallel edits.
- **You are running two to four tasks yourself today:** Worktrees, one terminal or tmux session per task.
- **You want work to continue with your laptop closed:** A provider cloud, if your team uses one agent and one code host.
- **Your team wants agents working its backlog:** An orchestration platform, so tasks start from team tools, run in consistent environments, and arrive as pull requests everyone can review.

## Problems that show up with parallel agents

These appear whichever way you orchestrate. Plan for them before adding more agents.

- **Merge conflicts:** Split work by module or file ownership, and keep each task to one pull request.
- **Review capacity:** More agents produce more pull requests. Measure how many your reviewers can handle before adding agents.
- **Shared resources:** Ports, local databases, and caches collide on one machine. Separate machines per task remove the problem.
- **Cost:** Every subagent, teammate, and parallel session uses its own tokens. Check usage after the first few runs.
- **Missing context:** Workers do not see the lead's conversation. Put file paths, constraints, and acceptance checks in each task prompt.

## FAQ

### How many coding agents can I run in parallel?
Claude Code allows 20 concurrent subagents by default, and Anthropic suggests starting agent teams with three to five teammates. In practice the limit is conflicts on one machine and how many pull requests your team can review, not the agent itself.

### What is the difference between subagents and agent teams?
Subagents run inside one session and report results back to the main agent. Agent teams are separate Claude Code instances that share a task list and message each other, which costs more tokens but lets teammates coordinate on their own.

### Do I need git worktrees to run several agents?
On one machine, yes, unless every agent only reads code. Without separate worktrees, agents edit the same checkout and overwrite each other. Cloud options give each task its own machine instead.

### Can I orchestrate Claude Code and Codex together?
Yes. On your own machine, run each in its own worktree. Provider clouds run only their own agent, while Replicas lets you choose Claude Code, Codex, Cursor, or OpenCode per task in the same environment.

## Orchestrate your team's agents without building the platform

Replicas includes a 14-day free trial with no credit card required. Connect a repository, define the environment once, and assign a few independent tickets from the dashboard, Slack, or Linear. Each task runs in its own Linux VM with the agent you pick and comes back as a pull request.

## Related docs

- [What is an AI agent orchestrator?](https://replicas.dev/resources/ai-agent-orchestrators): The orchestrator-worker pattern, and Claude Code and Codex as orchestrators.
- [Agent orchestration platforms](https://replicas.dev/resources/agent-orchestration): Patterns and nine orchestration platforms compared.
- [Multi-agent orchestration for coding agents](https://replicas.dev/resources/multi-agent-orchestration-for-coding-agents): Queues, isolation models, and a reference architecture for a fleet.
- [Run parallel sessions with worktrees](https://code.claude.com/docs/en/worktrees): Anthropic's reference for --worktree, .worktreeinclude, and cleanup.
- [Claude Code agent teams](https://code.claude.com/docs/en/agent-teams): Setup, display modes, and limitations of agent teams.
- [Codex subagents](https://learn.chatgpt.com/docs/agent-configuration/subagents): Built-in and custom Codex agents and their settings.
