How to run multiple Claude Code agents in parallel
Running several Claude Code agents on one project is easy to start and easy to get wrong. How to split the work, isolate the agents, give them a way to test, and review what comes back.
Published
Running a second Claude Code agent is one command away. Running five of them on one project and getting five useful results back takes a bit more thought. This is the checklist we use — it works whichever tool you pick.
1. Split the work into independent tasks
Parallel agents pay off when the tasks do not depend on each other: a bug fix in the login route, a new endpoint, tests for an untested module, a dependency bump. They pay off less when task B needs the result of task A.
A few rules of thumb:
- One task, one goal. "Add rate limiting to the login route" beats "improve auth".
- Split along boundaries. Tasks that touch different modules or files rarely conflict when the branches meet.
- Say how to check it. "Six wrong passwords from one address should end in 429" gives the agent something to verify, not just something to write.
2. Give every agent its own copy of the code
Two agents in one working directory will edit the same files and run tests against each other's half-finished changes. Each one needs its own place:
- A git worktree — a second checkout of the same repository on its own branch. Fast and light; the runtime (ports, databases) is still shared.
- A container — its own files, processes and network. Slower to start, but nothing is shared.
- A cloud session — a VM on the vendor's infrastructure.
We compare these options in detail in git worktrees vs containers for AI agents.
3. Give every agent a way to run what it wrote
An agent that cannot run the code is guessing. For most projects "running the code" means more than unit tests: the API needs its database, the worker needs its queue. If five agents share one database, their migrations and test data collide.
So decide up front how each agent gets its runtime:
- with worktrees, separate ports per agent (many tools set a port variable per workspace) and separate databases or schemas,
- with containers, a
docker-composefile that brings up the whole stack per task, - with cloud agents, an environment or setup script on the vendor's platform.
4. Keep the agents running without babysitting
Agents work for minutes to hours. Decide where they run so that the work does not stop when you walk away: a laptop that goes to sleep stops its agents, a server or a spare machine does not. Check how you will see that an agent is done or waiting for an answer — notifications, a dashboard, a phone.
5. Review before anything becomes a commit
The bottleneck moves from writing code to reading it. Plan for that:
- read each change as a diff against its base, not as a stream of terminal output,
- comment on specific lines and send the agent back, instead of fixing it by hand in another window,
- commit and open the pull request only when you are happy.
6. Merge like you would with colleagues
Isolation ends where Git begins. Two branches that changed the same lines still conflict. Merge the smallest, safest change first, rebase the rest, and let an agent resolve the conflicts in its own session if they are mechanical.
Common mistakes
- Starting too many at once. Five agents produce five diffs to read. Start with two or three and add more once reviewing keeps up.
- Sharing one database. The classic failure: agent A's migration breaks agent B's tests, and B "fixes" code that was never broken. Give each agent its own data, or keep database work to one agent at a time.
- Vague tasks. An agent that does not know what "done" looks like will stop at "it compiles". Name the check it should run.
- Forgetting setup. A fresh worktree has no
node_modulesand no.env.local. If setup is manual, every new agent starts by failing. - Reviewing in the terminal. Scrolling back through an agent's output is not a review. Read the diff.
- Burning through limits. Every agent is a full session that draws on your AI plan's usage limits. Parallel work reaches them sooner.
Picking a setup
Three setups cover most teams:
- Everything on your laptop, worktrees. Quickest to start and free in most tools. Fits small tasks with fast tests. Apps such as Orca, Conductor (Mac only) and Claude Squad work this way.
- The vendor's cloud. No machine to keep awake, and the vendor's coordination features on top. Claude Code Projects and Cursor Cloud Agents are examples; check what the environment can run and how usage is billed.
- Containers on a machine you own. Each task gets its own running stack, the compute stays yours, and you need Docker. This is the setup WorkMux is built for.
Doing it with WorkMux
WorkMux is built around this checklist. Each task is a session: a container on
a Docker host you connect, with a copy of the repo and the services from your
docker-compose file, so every agent can run its change against its own
stack. The session runs Claude Code or Codex CLI with your own account, and you
follow the agents, read the diffs, comment on lines and commit from any
browser — the work keeps running on the connected machine when you close it.
The step-by-step setup is in our guide: how to run several AI coding tasks in parallel. If you are still choosing a tool, the comparison hub covers Orca, Conductor, Cursor, JetBrains Air and others, and the home page shows WorkMux in action.
Frequently asked questions
Can I run several Claude Code sessions on the same repository?
Yes, but not in the same working directory. Give each session its own copy of the code — a git worktree, a clone or a container — or they will overwrite each other's files and test each other's half-finished changes.
How many Claude Code agents can I run at once?
There is no fixed number. The practical limits are your AI plan's usage limits, the memory and CPU of the machine running the agents, and how many results you can review properly.
Do parallel agents cause merge conflicts?
They can. Isolation stops agents from overwriting each other while they work, but two branches that changed the same lines still have to be merged. Split tasks along file or module boundaries to keep that rare.
Try WorkMux on your own project
Free: one machine of your own, several environments at once, your own AI account, no card.