# Running Claude Code, Codex and Cursor agents in parallel: one machine each, from splitting the work to merging it

Running one coding agent is a conversation. Running five at once is closer to running a small team: the work has to be split so people do not edit the same lines, everyone needs somewhere to work, someone checks in on progress, and the results come back as changes you can review one at a time.

This post is about that second situation, for teams using Claude Code, Codex or Cursor. It covers how to split the work, why each agent should get its own machine, and the commands for checking on and reviewing several agents with the Sandscale CLI (version 1.4.1). It does not repeat the case against running agents on a laptop; our post on [what laptop agents cost the team](https://sandscale.dev/blog/coding-agents-on-your-laptop-what-it-costs-the-team?ref=hashnode-running-coding-agents-in-parallel-one-machine-each) covers that.

## Split the work before you start the agents

Most failed parallel runs fail at the split, not at the machine. Two agents that both "clean up the API layer" will produce two branches that conflict everywhere, and someone spends the afternoon merging them.

Good tasks to run side by side share these properties:

- **They touch different files.** Write down which directories each task owns. If two tasks need the same file, run them one after the other, or make one task own the shared change and the other build on its branch.
- **Each has its own check.** "The tests in `packages/search` pass" is a finish line an agent can reach and you can verify. "Make it better" is not.
- **Each fits in one pull request.** If you could not review it in one sitting from a person, you will not review it from an agent either.
- **They do not depend on each other's unmerged work.** If B needs A's new function, start B after A's branch exists, from that branch.

A short task list in the repository, or in your issue tracker, with the owned paths and the check for each task, does more for a parallel run than any setting.

## Why each agent needs its own machine

Separate clones or git worktrees on one computer solve the file problem. They do not solve the rest: the agents still share ports, CPU, memory, caches and the user account. Two dev servers want the same port, one agent's build slows another agent's tests into timeouts, and the agent reads that timeout as a real bug.

With a machine per agent, those problems are gone by construction. [Sandscale](https://sandscale.dev/workspaces?ref=hashnode-running-coding-agents-in-parallel-one-machine-each) gives each agent its own workspace: a persistent cloud computer on its own Firecracker microVM, with its own disk, ports, CPU and memory. The repository, branch, installed tools and the agent's session are still there the next time you open it.

## Start one workspace per task

```sh
sandscale workspace templates-list
sandscale workspace create --name agent-search --template-id TEMPLATE_ID
sandscale workspace create --name agent-billing --template-id TEMPLATE_ID
sandscale workspace create --name agent-docs --template-id TEMPLATE_ID
```

Name each workspace after its task, so the list reads like your task board. `create` asks you to confirm before it changes anything. `sandscale workspace list` shows all of them with their ids.

Connect to each one, clone the repository, check out the task's branch, and start the agent inside `tmux` so it keeps going when you disconnect:

```sh
sandscale workspace ssh agent-search
tmux new -s run
```

Give the agent the task, the paths it owns and the check that ends it. If your repository has an `AGENTS.md`, Claude Code, Codex and Cursor will all read it; our post on [one AGENTS.md for agents on their own machines](https://sandscale.dev/blog/agents-md-for-coding-agents-on-their-own-machines?ref=hashnode-running-coding-agents-in-parallel-one-machine-each) covers what to put in it. Detach with `Ctrl-b d` and move on to the next workspace.

An agent in a workspace needs network access to reach its model provider and your git host, so check what your plan and your organization's policy allow before you start.

## Check on every agent from one terminal

You do not need to open a shell on each machine to see how it is going. `workspace exec` runs one command in a running workspace as you and returns its exit code, output and errors:

```sh
sandscale workspace exec --ws-id WORKSPACE_ID --command '["sh", "-c", "cd ~/app && git log --oneline -5 && git status --short"]'
```

Run it against each workspace id from `workspace list`. It asks you to confirm each run, since it changes state on the machine. The CLI's help says only the workspace's owner can run commands this way, with their own sign-in, and that every run is audited without its command text. The same command form runs a task's check on its machine, so you can see whether an agent's tests pass without asking the agent.

## Review each agent's running app

Before you read a diff, look at what the agent built. Because every machine has its own ports, every agent can use the same dev server port, and you forward each one to a different port on your computer:

```sh
sandscale workspace port-forward agent-search 3001:3000
sandscale workspace port-forward agent-billing 3002:3000
```

The forwards listen on 127.0.0.1 until you press Ctrl+C. Our post on [port-forwarding a dev server from a workspace](https://sandscale.dev/blog/port-forwarding-a-dev-server-from-a-workspace?ref=hashnode-running-coding-agents-in-parallel-one-machine-each) has the details.

To read and edit code on an agent's machine in your editor, `sandscale workspace ssh-config agent-search` prints a Host block for `~/.ssh/config`. Add it once, and the CLI's help says VS Code Remote-SSH and Cursor list the host. The block holds no key or token; the CLI signs each connection with a short-lived certificate.

## Merge branch by branch

Each agent pushes its own branch and opens a pull request, so review is the same as for a person's work: one pull request at a time, with the task's check in CI. Merge the ones that touch shared code first, then ask the remaining agents to rebase on `main` in their own workspace before you review them. A rebase conflict on an agent's machine is the agent's problem to solve, not yours.

When a task is done, stop its workspace:

```sh
sandscale workspace stop --ws-id WORKSPACE_ID
```

Its disk is kept and its compute stops being used. A running workspace uses your plan's vCPU-hours whether the agent is busy or waiting, so stop the ones you are not using. You can also set a time to live when you create a workspace, as in our post on [overnight agent runs](https://sandscale.dev/blog/scheduling-workspaces-for-overnight-agent-runs?ref=hashnode-running-coding-agents-in-parallel-one-machine-each).

## Or let a lead agent hand out the tasks

On Pro and up, [Agent Cloud](https://sandscale.dev/docs/concepts/agent-cloud?ref=hashnode-running-coding-agents-in-parallel-one-machine-each) does the start-and-collect part for you: you give a task to an agent in one of your workspaces, watch it work, and get a branch and a pull request back. A lead agent can hand out tasks to other agents, follow them, and collect the pull requests. Every step goes through your organization's policies and approvals and lands in the audit log.

## What parallel agents do not fix

- **A bad split.** Overlapping tasks still produce conflicting branches, however many machines you have.
- **Review capacity.** Five agents produce five pull requests. If one person reviews all of them, that person is the limit. Plan the number of agents around your reviewers.
- **Wrong code.** Each agent can still be confidently wrong. The task's check catches some of it, and review catches the rest.

The point of one machine per agent is that the agents stop interfering with each other and with you, so the team can run as many as it can review, and get more done.

To start, the [Quickstart](https://sandscale.dev/docs/quickstart?ref=hashnode-running-coding-agents-in-parallel-one-machine-each) walks through connecting Claude Code, Codex or Cursor, and the [workspace guide](https://sandscale.dev/docs/guides/workspaces?ref=hashnode-running-coding-agents-in-parallel-one-machine-each) covers workspaces step by step.

*Originally published on the [Sandscale blog](https://sandscale.dev/blog/running-coding-agents-in-parallel-one-machine-each?ref=hashnode-running-coding-agents-in-parallel-one-machine-each).*
