matrix.log / guides / parallel-ai-agents-multi-agent-pipelines
Guides
All articles

How to run parallel AI-agent pipelines in the cloud

Build reliable multi-agent pipelines with isolated worktrees, durable compute, task ownership, review queues, and observable handoffs.

Matrix OS10 min read

Parallel AI Agents: Architecting Multi-Agent Pipelines

Running one AI coding agent is useful. Running several in parallel — each handling a different task, on a machine that never sleeps — is a different category of productivity entirely.

Parallel agents expose coordination problems quickly. Two terminal agents can compete for local CPU, edit the same checkout, reuse ports, or change one database. Managed remote agents have different runtimes, but their branches and review order still need coordination.

This article covers how to build multi-agent pipelines that actually run continuously: what separates them from single-agent workflows, where they typically break, and which infrastructure decisions actually matter.


Why Parallel Agents Are Different From Sequential Ones

Sequential agent workflows are simple: give an agent a task, wait for it to finish, review, hand it the next one. The bottleneck is always the current task completing before anything else moves.

Parallel agents change that constraint. Multiple agents work on independent tasks at the same time, sharing file state where needed, and you review outputs rather than babysit progress. The throughput gain is real — but so are the coordination requirements.

Three things break in parallel setups that work fine sequentially:

Session isolation. Two agents writing to the same file simultaneously without coordination produces conflicts. Each agent needs its own session context, even when they share a filesystem.

Persistence. A sequential agent can survive a restart because the next task hasn't started yet. A parallel pipeline mid-run does not recover gracefully from a dead session. If one agent dies, you need to know which one, what state it was in, and whether it needs a restart or a handoff.

Observability. With one agent, you watch the terminal. With four running at once, you need status across all of them without opening four separate windows and manually tracking each.


The Persistence Problem Is the Foundation Problem

Before you think about orchestration, task queues, or agent selection, one question needs an answer: where do these agents actually run?

If the answer is "on my laptop," you have already introduced the most common failure mode. Local sessions die when the machine sleeps, the terminal closes, or the VPN drops. That is fine for a five-minute task. It is not fine for an overnight refactor or a pipeline running while you are on a flight.

Continuous parallel agents need compute that outlasts any individual device or session — a machine that is always on, always connected, and not dependent on whether your laptop lid is open.

This is the core idea behind cloud computers for AI agents: dedicated hosted machines where terminal agents continue independently of laptop sleep and local disconnects. Git checkpoints and process supervision provide recovery when the remote host or agent fails.


Designing a Multi-Agent Pipeline

Define Task Boundaries First

The most important architectural decision is not which agents to use — it is how you divide the work. Good parallel pipelines assign tasks that are genuinely independent, or that have well-defined handoff points.

Tasks that parallelize well:

  • One agent fixes a bug while another writes the corresponding test
  • One agent triages Sentry errors while another drafts a changelog from recent commits
  • One agent handles a Linear ticket while another reviews a PR diff

Tasks that do not parallelize cleanly without coordination:

  • Two agents editing the same module at the same time
  • An agent that depends on output from another agent that hasn't finished yet
  • Tasks requiring sequential approval before the next step can begin

The second category is not impossible to parallelize — it just requires explicit sequencing logic, which is where orchestration comes in.

Isolated Sessions With Shared File State

Each agent in a parallel pipeline should run in its own isolated session. This prevents one agent's environment variables, tool calls, or partial writes from interfering with another's.

At the same time, agents often need to read from and write to a shared codebase. The right model is isolated sessions on a single persistent machine with shared filesystem access — not separate machines syncing state over a network.

This matters in practice. If Agent A writes a utility function to /src/utils/, Agent B should be able to import it without a git push and pull cycle. Shared file state on one machine makes this natural. Distributed machines make it complicated.

Orchestration: Task Queues and Human-in-the-Loop Handoff

Once multiple agents are running, you need a way to manage what they work on and when you step in.

A task queue lets you assign work asynchronously. You define the tasks, agents pick them up, and you review outputs when they complete — rather than watching each one run. That is the difference between managing a pipeline and babysitting a terminal.

Human-in-the-loop handoff matters just as much. Some tasks require a decision before the next step: a PR that needs approval before merge, a diff that looks wrong, a branch conflicting with main. The pipeline should pause at those points and notify you, not proceed blindly.

Matrix OS handles this through Symphony, which manages parallel task queues, tracks agent status across sessions, and supports branch/diff/PR review with human-in-the-loop handoff built in. You can see what each agent is doing, approve or redirect, and let the pipeline continue — all from a browser.


Choosing the Right Agents for Parallel Work

Different agents have different strengths, and a well-designed pipeline often uses more than one. Claude Code handles complex, multi-step reasoning well. Codex is efficient for code generation and completion. Cursor's agent mode suits editor-centric refactors. Gemini CLI is useful when large context windows matter.

The key is that your infrastructure should not force you to pick one. If your pipeline runs on a machine that supports isolated sessions per agent, you can match the agent to the task rather than working around your setup's limitations.

Running Claude Code, Codex, and Gemini CLI simultaneously in isolated sessions on the same persistent machine — with shared access to the same codebase — is a meaningfully different capability than running them one at a time on a local terminal.


Scheduled and Triggered Workflows

Not every agent task needs to be started manually. Some of the most useful parallel pipelines run on a schedule or fire in response to an event.

A few examples:

  • An agent that runs every morning, pulls the latest Sentry errors, and drafts a triage report
  • An agent triggered by a new Linear ticket that opens a branch and starts the implementation
  • An agent that runs after every merge to main and updates the changelog

This requires a resident agent that can respond to triggers, connect to external tools, and manage notifications and approvals. Hermes, Matrix OS's resident agent, handles exactly this — scheduled workflows, tool connections across GitHub, Linear, Slack, Sentry, Datadog, and others, plus approval flows that keep humans in the loop without requiring them to manually kick off each task.

The result is a pipeline that runs in the background, surfaces decisions when needed, and handles the rest on its own.


Infrastructure Requirements for Always-On Pipelines

Running parallel agents continuously puts real demands on the underlying machine. A few things to size correctly:

CPU. Multiple agents running at once use CPU in parallel. A 2 vCPU machine handles light workloads, but a pipeline with three or four active agents benefits from 4 or more. For heavy parallel work, 12 vCPUs gives you real headroom.

RAM. Each agent session holds context in memory. 4 GB is a starting point; 8 GB handles most multi-agent setups comfortably; 24 GB is appropriate for large codebases or many simultaneous sessions.

Disk. Shared file state, build artifacts, logs, and database files add up. 80 GB works for smaller projects; 160 GB or 480 GB is better for teams or long-running pipelines with significant output.

Session persistence. Non-negotiable. The machine must stay on and sessions must survive disconnects. Scale-to-zero compute, session-capped sandboxes, and local machines all fail this requirement for continuous pipelines.

Matrix OS provisions a dedicated cloud computer with plans sized for different levels of concurrency. Remote processes continue across laptop sleep and local disconnects. You can inspect the workspace from a browser or terminal, while Git worktrees and process supervision provide isolation and recovery.

If you have been running into sessions dying when your laptop closes, the infrastructure answer is the same whether you are running one agent or five.


Observability and Control

A parallel pipeline you cannot observe is not useful — it is just noise running in the background.

Useful observability for multi-agent pipelines means knowing which agents are running and what they are working on, seeing status updates without opening a terminal per session, getting notified when a task completes, fails, or needs a decision, and being able to review diffs, branches, and PRs without context-switching to a separate tool.

The Matrix OS web shell gives you windows, terminals, a file manager, previews, and agent sessions in a single browser interface. Symphony tracks agent status across all running sessions. Hermes handles notifications through Slack, Discord, or Gmail so you know when something needs your attention.

This is what a canvas-first workspace looks like in practice — everything visible from one place, without juggling tools.


A Practical Starting Point

If you are moving from a single-agent workflow to a parallel one, start small. Pick two tasks that are genuinely independent — a bug fix and a test — and run them as separate sessions on the same machine. Review the outputs together. That is the core loop.

From there, add a scheduled trigger. Have an agent run every morning on a defined task and see what it produces without you starting it manually. That is the beginning of a pipeline that runs continuously.

The goal is not to have agents running for the sake of it. It is to hand off defined work, trust that it will run to completion, and come back to finished output rather than a dead terminal.

You can explore what this looks like at matrix-os.com.


FAQs

What makes parallel AI agents different from just running multiple terminal sessions?

Multiple terminal sessions on a local machine still share the same CPU and RAM, die when the machine sleeps, and give you no coordinated view across sessions. Parallel agents on a persistent cloud machine run independently, share file state cleanly, and survive any device disconnect. The infrastructure is the difference.

Can different agents share the same codebase without conflicts?

Yes, if they run in isolated sessions on a single machine with shared filesystem access. Each agent has its own session context, so environment variables and tool calls do not interfere — but they can all read from and write to the same directories. Coordination logic like task queues and handoff points prevents write conflicts on the same files.

How do I know when a parallel agent finishes or needs my input?

Orchestration tools that support human-in-the-loop handoff will pause the pipeline and notify you when a decision is required. Matrix OS's Symphony handles task status tracking and handoff, and Hermes can send notifications through Slack, Discord, or Gmail so you are not watching a terminal.

What happens if one agent in a parallel pipeline fails mid-task?

A well-designed pipeline isolates failures to the affected session — the other agents keep running. You need visibility into which session failed and what state it was in, which is why observability is a first-class requirement, not an afterthought. With persistent sessions, a failed agent can often be restarted without losing the shared file state other agents depend on.

Do I need a separate machine for each agent?

No. Multiple agents can run in isolated sessions on a single persistent machine with shared file state. Separate machines add network latency, sync complexity, and cost without a meaningful benefit for most developer workflows. A single well-provisioned machine handles most parallel agent setups.

Which agents work best for parallel pipelines?

It depends on the tasks. Claude Code handles complex reasoning and multi-step problems well. Codex is efficient for code generation. Gemini CLI is useful when large context windows matter. Cursor's agent mode suits editor-centric refactors. The best pipelines match the agent to the task rather than committing to one for everything.

How much compute do parallel agents actually need?

A two-agent pipeline on a modest codebase runs fine on 4 vCPU and 8 GB RAM. Three or four active agents on a larger project benefit from 8 to 12 vCPU and 16 to 24 GB RAM. Disk depends on codebase size, build artifacts, and how long the pipeline runs. Size for peak concurrent load, not the average.