aq.dev / guides / run-multiple-ai-coding-agents-in-parallel

How to Run Multiple AI Coding Agents in Parallel

To run multiple AI coding agents in parallel, give every agent its own task, its own working directory, and its own branch, then keep their runtime resources (ports, databases, env files) from colliding. The working directory part has a standard answer: one git worktree per task. It works the same whether the agents are three Claude Code sessions, a Claude Code session next to a Codex session, or any mix of terminal agents, because every serious coding agent today is a CLI that operates on whatever directory you start it in.

This guide covers the vendor-neutral setup: why mixed-agent parallelism is worth the trouble, the isolation rules that make it safe, what each major CLI gives you natively, and where the do-it-yourself approach runs out. If you only run Claude Code, the narrower companion guide on running multiple Claude Code sessions in parallel goes deeper on that single tool.

Why run different agents side by side?

The first reason to parallelize is throughput: agents spend most of their wall-clock time reading files, running tests, and waiting on tool calls, so a second and third independent task costs you little beyond review attention. That argument is the same for one CLI or five.

The reason to mix CLIs is that the agents genuinely differ. Teams commonly route deep refactors and architecture-heavy work to one agent, quick mechanical fixes or test-writing to another, and keep a plain shell open for the things no agent should do unsupervised. Model strengths shift with every release, and subscriptions differ per engineer, so a workflow that hard-codes one vendor ages badly. A parallel setup built on directories and branches instead of a vendor's own orchestrator lets you swap agents per task without changing anything else.

Two rules keep this sane:

The isolation rule: one task, one worktree, one branch

A git worktree is an extra working directory attached to the same repository, checked out to its own branch. Each agent gets a private copy of the files without a second clone, and commits land on separate branches you can review independently. The setup is identical for any CLI:

cd ~/code/myapp
git worktree add ../myapp-auth -b fix/auth-timeout
git worktree add ../myapp-search -b feat/search-filters

# Terminal 1: Claude Code on the auth fix
cd ../myapp-auth && claude

# Terminal 2: Codex on the search feature
cd ../myapp-search && codex

# Terminal 3: Cursor's terminal agent on a third task
git worktree add ../myapp-flags -b chore/flag-cleanup
cd ../myapp-flags && cursor-agent

That is the whole trick. The agents never see each other's files, and nothing about it is vendor-specific. Our git worktrees guide covers the mechanics in more depth, including cleanup and the gotchas around untracked files.

What the major CLIs give you natively

Vendors have started building worktree support into their own tools, but coverage is uneven, and each vendor's automation only manages its own agent. As of August 2026:

The pattern to notice: every vendor's automation stops at its own tool. The moment your team runs two different agents, the common denominator is what it always was, directories, branches, and a terminal multiplexer.

Isolate the runtime, not just the files

Worktrees solve file collisions. The next failures are runtime collisions, and they surface the first time two agents both try to verify their work:

None of this is hard, but it is per-task ceremony, and it is the part people underestimate. Ten minutes of setup before each agent types its first character is the real cost of the manual route.

Keep the sessions alive, and visible

Parallel agents multiply the cost of your laptop's lid. Three long-running sessions die together when you close it, and terminal tabs make it easy to forget which agent stalled an hour ago. The standard fixes are tmux (one named session per task, so sessions survive a dropped connection) and moving the whole arrangement to a server you SSH into, which our guide to self-hosted AI coding agents walks through.

What tmux on a server still cannot give you is other people. One person can babysit two or three agents in a multiplexer. A team cannot: nobody else can see which sessions are running, read what an agent is doing, or take over a stuck session without being handed SSH access to someone's box. Every step up in agent count is a step up in the amount of glue you are personally maintaining: worktree creation, port maps, env copying, cleanup of stale branches and forgotten dev servers.

Where AQ fits

AQ is the multiplayer coding harness where engineering teams run AI coding agents like Claude Code and Codex together: shared live terminals, a code editor, and app previews, in your own cloud. It is the pattern in this guide, operated for you, and it is agent-agnostic by construction: agents run as real CLIs (Claude Code, Codex, Cursor Agent, Kimi, Grok, or plain shells) in persistent tmux sessions on your team's VM, streamed live to the browser. Each workspace gets its own isolated git worktree on a branch named ai/{id}-{slug}, with dependencies installed automatically and a one-click rebase onto main, so the per-task ceremony above disappears. Each workspace also gets its own live dev-server preview, which ends the port bookkeeping.

The parallel sessions survive a closed laptop and resume from any device, and the team problem is the product's actual point: teammates open the same workspace and watch the same live session, typing into someone else's terminal only after its owner approves a control request in one click. Engineers sign into each CLI with their own accounts (AQ never marks up model usage), commits and PRs use per-user GitHub auth, and PRs are tracked on the workspace they came from.

Pricing is two plans. Free is a personal sandbox for one person: AQ creates the machine, nothing to install. The Team plan is $50 per user per month (promotional; standard $200, billed monthly) with your whole team, VMs you connect from your own cloud account or a dedicated always-on AQ-managed VM in its own isolated network, and your rate locked for your first 12 months. Newly invited teammates are free for their first 14 days.

If you are one engineer running two agents, the worktree commands above are enough, and you should start there. The harness earns its place when the agent count or the head count grows past what one person's tmux config can carry.

Frequently asked questions

Can I run Claude Code and Codex on the same repository at the same time?

Yes, and it works well, with one rule: never on the same branch. Give each agent its own git worktree checked out to its own branch, so neither agent ever sees the other's half-finished edits. Merge conflicts then happen at PR time, where a human resolves them deliberately, instead of at runtime where an agent reacts to files it does not understand.

How many AI coding agents can I run in parallel?

The binding constraint is your review bandwidth, not compute. Most practitioners settle at two to four concurrent agents: enough that something is always ready for review, few enough that you still read every diff properly. Past that, quality control becomes the bottleneck, and adding agents adds unreviewed code rather than shipped code.

Do I need Docker or containers to isolate parallel agents?

Not for file isolation: git worktrees already guarantee that agents never write to the same checkout. Containers add value one layer down, when agents run commands with side effects beyond the repo (global installs, system services) or when you want hard resource limits. Many teams run worktrees plus per-task ports and databases and never need containers at all.

Why do my parallel agents' dev servers keep failing to start?

Port collisions, almost always. Every worktree runs the same app, and every copy defaults to the same port, so the second and third servers fail to bind. Parameterize the port through an environment variable, give each worktree its own env file with a distinct port, and tell the agent which port its task owns.

Which AI coding workspace supports any agent CLI?

Look for a workspace that runs agents as real terminal CLIs in a shell rather than through a vendor-specific integration; anything that can run a shell can run every current agent. AQ works this way: workspaces run Claude Code, Codex, Cursor Agent, Kimi, Grok, or a plain shell in persistent tmux sessions on your team's VM, each in its own isolated worktree, so switching agents per task means typing a different command.