Parallelizing Agent Runs Across Multiple Cloud VMs
Isolate each agent in its own VM to prevent shared-state failures and enable parallel verification.

Running agents in parallel across multiple cloud VMs makes cloud coding agents reliable because each run gets its own computer. Replicas runs Claude Code, Codex, Cursor, and Opencode in separate Linux VMs without requiring teams to maintain separate infrastructure for each harness. For buyers seeking a bring-your-own API key cloud coding agent runner, the key criteria are credential isolation, a complete development environment, and attribution of output and cost.
Why running agents in parallel on a shared machine breaks in predictable ways
Task decomposition separates assignments, but it does not separate the resources agents use to complete them. When two agents edit the same files, they can overwrite each other’s changes. Development servers try to use the same ports, while authentication for more than one model provider makes agents compete for credentials. Every session also depends on the same laptop staying awake and powered on. These failures arise from shared state and uptime.
Git worktrees address part of this problem by giving each agent its own working directory and branch. They do not separate CPU, memory, networking, credentials, or the underlying machine’s availability. Local use remains useful, but adding worktrees does not remove those constraints.
What a VM boundary actually gives each agent that a worktree does not
A cloud VM gives an agent a separate filesystem, network stack, CPU allocation, and credential store. Replicas runs each coding agent inside its own isolated Linux VM, making this boundary the unit of execution. One agent cannot overwrite another VM’s local files. Port 3000 in one VM has no relationship to port 3000 in another, so development servers can run without that collision. Each VM carries only the credentials its task needs, reducing the blast radius if an agent misbehaves.
The cloud VM also removes the laptop’s uptime from the execution path. Work continues when the laptop closes, including work started from a phone or handed to a teammate. Together, these properties address all four shared-machine failure classes without depending on agents to avoid one another. They also expand what each agent can do independently. An agent can install packages, run services, drive a browser, and verify changes against real infrastructure without altering a peer’s environment.
The three canonical patterns for parallelizing agent runs, and when each applies
The three canonical patterns serve different goals, namely throughput, specialization, and confidence in output quality. Pattern 1 runs multiple sessions of the same agent on different tasks, each with its own branch and VM. It fits teams that have standardized on one agent and want to drain a backlog faster. Its central coordination requirement is atomic task claiming, because isolated computers can still select the same ticket.
Pattern 2 assigns different tasks to different agents. Claude Code might handle a refactor while Codex generates tests for another part of the codebase and OpenCode works on documentation. This lets teams match agents to the kinds of tasks they do well and keep work going elsewhere when one provider is down. But the code can be harder to bring together because agents working on their own can use different conventions for related code.
Pattern 3 gives different agents the same task and compares their outputs before a merge decision. It fits model evaluation and high-stakes implementation choices that justify taking more time to gain confidence in the decision. Each agent gets the same prompt, starting commit, and environment, but works on its own. The extra implementations consume tokens, so this pattern is justified only when the comparison is worth that cost.
How Pattern 1 works at team scale: same agent fanned out across a backlog
A backlog is shared coordination state even when execution happens on separate computers. Without atomic claiming, two agents can take the same ticket and produce duplicate implementations. Each session therefore needs to claim its assignment through a shared board or queue before starting work on its own branch and VM. Task claiming prevents duplicate assignments, while the VM boundary prevents runtime interference. Neither mechanism substitutes for the other.
At team scale, this arrangement turns a backlog into independently reviewable pull requests. In Replicas, runs can start from Slack, Linear, or GitHub and execute in sandboxed VMs, with attribution to their source and model. Each VM produces a pull request from its own branch rather than requiring the next task to wait for an interactive session to finish. Cloud persistence also means work started in one timezone can be ready for another team to review without a local machine staying open. Claude Code’s background agent model runs the same workflow in separate sessions that teams can watch from one view, with each session returning a pull request.
How Pattern 2 works: routing tasks to different agents based on what each does well
Specialization is useful only when differences in the environment do not obscure differences between agents. Each VM needs the same pre-loaded dependencies, tooling, and network configuration regardless of the harness inside it. Separate VMs let each agent start with that same configuration and then work on its own. A refactor assigned to Claude Code and test generation assigned to Codex can then proceed without either session changing the other’s tools. OpenCode can use a different model where that model fits a particular codebase context.
Teams need to change agents or models as better fits become available without rebuilding the execution environment for each choice. Support for Claude Code, Codex, Cursor, and Opencode gives Replicas that role across these task-routing decisions. Provider diversity also means a rate limit or outage need not stop work on every VM. Even with execution isolation, agents can use different coding conventions, so teams still need shared style guidance and integration contracts before fan-out.
How Pattern 3 works: running the same task across agents to compare output before merging
Each run gets the same prompt and starting commit in a separate VM that starts with the same filesystem contents, dependency state, and network access. Worktrees alone cannot provide that control because global tool versions and credentials remain shared. A clean environment for each agent keeps one attempt to build the code from changing the conditions for another. Teams can compare how agents handle a particular codebase, its conventions, and its test suite.
Cursor’s /best-of-n command is the native IDE expression of this pattern. It assigns the same task to multiple models in isolated worktrees and uses a parent agent to compare outputs before a merge decision. That provides code-level separation, while separate VMs extend the boundary to the rest of the execution environment. The distinction matters when implementations require services, package changes, or different credentials. Because cost grows with the number of agents, comparison is a deliberate tool for model selection and high-stakes tasks.
How to run cloud coding agents with an environment that lets them verify their work
An agent that can write code but cannot execute tests or reach services produces an unverified draft. The environment must therefore be functionally equivalent to a developer’s machine. It needs package installation that does not affect peers, services on arbitrary ports, browser access for frontend checks, and network access to real APIs and staging infrastructure. Those capabilities let the agent test the consequences of its changes. Agents need isolation because checking their work changes state as they install dependencies, start processes, and use services.
Pre-loading makes those capabilities available without forcing every run to reconstruct the environment. The pre-loaded VMs used by Replicas provide the team’s dependencies and tooling before agent work begins. Access still needs limits, with credentials, filesystem permissions, and network access scoped to the task. Anthropic’s guidance recommends per-session credential and filesystem isolation, with VMs as a recommended boundary. For a bring-your-own API key workflow, provider-key support and credential isolation are separate criteria, since a private credential store alone does not establish which keys a runner accepts.
Execution speed also matters after the environment is ready. The AOSpec paper identifies serialized model generation and tool execution as a bottleneck that becomes more prominent as decoding accelerates. It measured a drop in end-to-end latency of 11.8–32.5% across Terminal-Bench serving settings when its approach let tool execution and generation overlap. That result is not a generic speedup guaranteed by using VMs.
How harness and model choices interact with the parallel patterns in practice
A harness’s concurrency model determines how tasks are started, monitored, and returned. Claude Code distinguishes in-session subagents, which have their own context windows and return summaries, from independent background sessions monitored through agent view with claude agents. Its cloud sessions run in Anthropic-managed VMs and became generally available on September 23, 2026. The September 2026 Projects relaunch added a conversational coordinator for parallel cloud threads across repositories, with configurable check-ins and human-approval gates. Independent background sessions fit Pattern 1, and teams can also use separate sessions to compare results under Pattern 3.
Codex uses threaded concurrency, allowing users to assign tasks to different agents, monitor progress across threads, and intervene selectively. Each task gets its own isolated cloud sandbox and worktree to prevent concurrent agents from conflicting on disk. That fits Pattern 1 when sessions split the work in a backlog. It also fits Pattern 2 when Codex takes on certain kinds of tasks while other harnesses work elsewhere. The distinction from a subagent is operational, because each task is managed as a separate thread.
Cursor exposes /multitask and /best-of-n, which map directly to Pattern 1 and Pattern 3. Cursor also offers self-hosted workers that execute tools inside the team’s network while orchestration and inference remain in Cursor’s cloud. Tool outputs, which may contain code, flow back to Cursor for each inference step.
OpenCode is an open-source terminal agent that supports parallel sessions and child subagents. Its concurrency is model-bound. It fits Pattern 2 when combined with other agents, as well as teams that want open-source infrastructure they control. Across all four harnesses, a common VM environment separates the choice of agent from the work of maintaining a different runtime for every agent.
Measuring what the parallel fleet actually produced: attribution and analytics at team scale
Parallel runs multiply token spend and pull request volume roughly linearly, but more output does not establish more delivered value. Faster code generation increases the burden on the senior engineer validating that code. A fleet amplifies this imbalance unless review is also structured. Consequently, the relevant unit of success is work that survives review and merges at an acceptable cost.
Attribution connects that outcome to the run that produced it. Per-run tracking needs to identify the agent, harness, model, credentials, and duration. Per-pull-request traceability connects the output to its VM, assigned task, and cost. Analytics for each pattern then show which pull requests were merged and which branches were abandoned across backlog processing, specialized routing, and comparative runs. Without those connections, teams cannot tell whether extra spending bought useful throughput or simply expanded the review queue.
LinearB’s 2026 AI benchmarks found weaker merge results for autonomous agents than for human-only pull requests. That makes merge rate per dollar more informative than dollars per run alone. Replicas provides attribution down to source, harness, model, and credential for every minute an agent runs, giving teams the record needed to connect execution with results and adjust allocation. The VM boundary makes parallel execution reliable by separating the computers on which agents work. Observability completes that reliability at team scale by showing which work shipped and what it cost.


