Agentic Coding Orchestration: Parallel or Sequential?
10 min read
Key takeaways
- Run coding agents in parallel only when tasks have disjoint file sets, independently failing test suites, and no ordering constraint between them.
- Most hidden collisions come from shared imports, migrations, and config files, so scan dependencies before launching each agent session.
- Git worktrees give each agent an isolated checkout and make file overlap visible through a trial merge before either agent finishes.
- One collision typically erases the time saved on three clean parallel runs, so sequencing is cheaper whenever dependencies exist.
- Orchestration tooling pays off at five or more concurrent sessions, multi-repo tasks, or heavy merge volume; below that, apply the dependency test in your head.
Agentic coding orchestration means deciding when coding agents run in parallel and when they run in sequence. Run agents in parallel only when their tasks share no files, no tests, and no ordering constraints; sequence them when any of those three overlap. This dependency test takes about a minute per sprint task and prevents the overwrites, duplicate work, and burned token budget that come from launching an agent fleet against colliding work.
When should you run coding agents in parallel instead of one at a time?
Run agents sequentially by default. Go parallel only when two tasks touch disjoint files, don't share test suites, and have no ordering constraint between them. That three-part dependency test, applied before each launch, matters more than which orchestrator you pick. The Reddit threads asking which orchestration tool to adopt keep circling the same point: the bottleneck is whether each agent can hold context and decide well across steps, not the tool layer.
Parallelism is a bet you pay for either way. If the dependency analysis was wrong, agents overwrite each other's work and you pay in retries and token spend. If it was right, you still pay attention cost: one team running up to thirty Claude Code and Codex sessions pays roughly $8 per merge request at API prices and describes losing track of which terminal tab is waiting and which is stuck (dev1alone on Dev.to). Sequential runs are slower per task and cheaper per mistake. We apply this same test to our own agent fleet at Aerunit, and we still get it wrong when a task quietly shares a fixture file with its neighbour.
More on how we structure these decisions at the Aerunit blog.
What makes two coding tasks safe to run at the same time?
Two tasks are safe to parallelize when they pass three criteria: disjoint file sets, test surfaces that fail independently, and no ordering constraint between them. If any criterion fails, run them sequentially or partition the work first. The test takes about a minute per pair and catches most of the overwrite-and-argue failures before you spend tokens on them.
Criterion 1: disjoint file sets
List the files each task will touch, including config, shared types, and migration files. If the sets overlap, the second agent to push reverts or conflicts with the first. Overlap on a shared types file is the most common hidden collision in multi-repo fleets, because two features often both extend the same interface.
Criterion 2: tests that fail independently
Each task's test suite must pass or fail based only on its own diff. If task A's change breaks a test that task B also runs, B's agent will "fix" A's half-finished work. Run the suite on a clean checkout plus the single diff to check this before launching both.
Criterion 3: no ordering constraint between the tasks
If one task's acceptance criteria depend on another's output (schema before migration, API before client), they are a pipeline, not a parallel pair. Chain them in one session or queue them. For more worked examples of the test applied to real sprint boards, see our guides on working with AI coding agents.
Scoring a real sprint's tasks against the test
| Task pair | Disjoint files | Independent tests | No ordering | Verdict |
|---|---|---|---|---|
| Add webhook endpoint + fix billing bug | Yes | Yes | Yes | Parallel |
| Two features extending the same types file | No | Yes | Yes | Sequential or split types first |
| Schema change + migration depending on it | Yes | No | No | Pipeline, one after the other |
Honest limitation: the file-set check relies on you predicting what an agent will touch, and agents sometimes edit files you did not list. Scoping the task prompt tightly, or running each agent in its own git worktree, reduces but does not eliminate that risk.
How do you detect hidden dependencies between agent tasks before they collide?
Most collisions come from imports, migrations, and config, not from the files you assigned. Run this check before launching each session.
Shared-module imports as a dependency signal
Trace what each task's target files import. If two agents both touch lib/auth.ts or a shared types package, they will conflict even if their assigned file lists never overlap. A quick grep of import statements across the two task scopes takes minutes and catches most of it. If both tasks pull from the same module, sequence them or split the module first.
Migrations, schemas, and shared config as collision magnets
Any task that adds a migration, edits a schema, or touches tsconfig, CI YAML, or dependency manifests is a coordination point by default. Allow only one agent to own those files per run; queue everything else behind it. The secondshiftdev writeup on running four coding agents at once describes the failure mode plainly: agents overwrite each other's work, duplicate it, and burn your token budget arguing about who is right. That cost is avoidable with a five-minute dependency scan before launch.
Using git worktrees to make collisions visible early
Give every agent its own git worktree so each works on an isolated checkout. Then run a trial merge between branches before either finishes; git surfaces the real overlap immediately. This is the state tracking layer an orchestrator like Aerunit automates across a fleet, and we write about these workflows on the Aerunit blog. The honest limit: worktrees isolate edits, not intent, so two agents can still build conflicting designs that merge cleanly.
What is the cost of a failed parallel run versus a slower sequential one?
The arithmetic of a collision
Run the numbers on a typical collision. Two agents spend 45 minutes each on overlapping work before anyone notices: that is roughly 1.5 agent-hours of token burn, plus the rework session where one agent untangles the merged mess, plus your own review time reading two diffs when one would have done. If you are paying per merge request, as teams running large agent fleets do, a wasted run is still a paid run, and the $8-per-merge-request figure from the thirty-session team means a single collision costs more than the sequential delay would have. The hidden cost compounds across a sprint: three collisions a week can erase the wall-clock gains that justified parallelism in the first place. A full breakdown of what a failed session typically costs sits in our guide to what a coding agent run really costs.
The hidden cost is review fatigue. A duplicate or overwritten change does not just burn tokens; it puts a confusing diff in front of a human who has to reconstruct what happened. That reconstruction is often slower than the original task.
When sequential is actually cheaper
Sequencing trades wall-clock time for determinism. If task B depends on task A's output, running them in parallel means one agent works against a stale tree and produces a diff you will throw away. The sequential run costs you the latency of A finishing first, but every token spent lands in a merge.
The rule: if the dependency test says tasks share files or ordering, sequence them. Parallel only pays when the collision risk is zero, because one collision typically erases the time you saved on three clean runs.
How do you structure a codebase so agents can work in parallel more often?
The dependency test from earlier sections only works if your repo has seams. Structure, not tooling, decides how many agents you can run before they collide.
Module boundaries as parallelism enablers
Agents collide through shared files. Draw module boundaries so that most tasks touch one module plus a stable interface, not three directories at once. Contract-first interfaces help here: if two agents each implement against a fixed interface definition, they can build both sides simultaneously and only reconcile at merge time. One practitioner running multi-repo swarms notes that the orchestrator matters less than whether each agent can maintain context across steps in a large codebase. Smaller, well-bounded modules are what make that context tractable.
Splitting test suites so agents don't share a failure domain
Shared tests are shared state. If every agent runs the full suite, one broken commit fails everyone, and agents start "fixing" each other's work. Per-module test suites, runnable in isolation and wired to per-module acceptance criteria, shrink the failure domain to the agent that caused it. Pair this with git worktrees so each session has its own checkout.
The honest caveat: Aerunit orchestrates and tracks sessions, but it cannot restructure a monolith for you. Boundary work is yours, and until it is done, most tasks will fail the parallel-safety test. For a broader map of where orchestration tools fit, see agentic AI coding tools.
How do you review and merge work from multiple agents without losing track?
State tracking is the review problem in disguise. When three agents finish within the same hour, you need to know which branch belongs to which task, what "done" meant, and what must land first. That comes from discipline, not tooling.
One branch, one acceptance criteria list
Every agent session gets its own branch, created before the prompt is written, and the task story carries the acceptance criteria the merge reviewer will check against. If the criteria live only in the prompt, they are gone by review time. GitHub's documentation for its coding agent is built around this pattern: each task produces a draft pull request linked back to the issue that spawned it (GitHub Copilot docs). Write your criteria into the issue, launch the agent from it, and review the diff against the list, not against your memory of the conversation.
Merge order matters more than merge speed
When two tasks touch shared files or shared tests, the second merge inherits the first one's changes, so merge in dependency order and rebase the remaining branches before their agents keep working. Vibe Kanban treats this as a core workflow: agents queue their work as reviewable merge requests, and a human decides what lands and in what sequence. The honest gap in our own product, Aerunit, is that it tracks branch state and flags ordering conflicts but does not yet auto-rebase a fleet after a merge; you still run that step yourself.
When is agentic coding orchestration overkill for a small team?
The point where coordination cost exceeds agent output
If you run one or two agents at a time on tasks you wrote yourself this morning, an orchestrator adds overhead without removing work. A terminal tab and a human reviewer beat state tracking at that scale. Orchestration earns its keep around three thresholds: five or more concurrent agent sessions, tasks spanning multiple repos, and enough merge requests per day that you lose track of which agent is waiting on you. Below that, the dependency test from earlier sections still applies, but you can apply it in your head.
Running the same criteria against Aerunit honestly
Aerunit is built for the fleet case, so it is overkill by its own criteria if you run two agents on one repo. It assumes you already pay for Cursor Cloud Agents or similar and feel the coordination cost daily, like the three-person team running thirty sessions. If your bottleneck is a single agent wandering off task, fix the task spec first. An orchestrator distributes work; it cannot make a vague task safe to parallelize.
FAQ
Can I run Claude Code and Codex agents on the same repository at once?
Yes, if each agent passes the three-part test: disjoint file sets, test suites that fail independently, and no ordering constraint between the tasks. Teams running thirty Claude Code and Codex sessions do this daily, but they pay roughly $8 per merge request and report losing track of which terminal tab is stuck.
How many parallel coding agents can one person actually supervise?
Attention, not tooling, is the limit. One team running up to thirty sessions describes losing track of which tab is waiting and which is stuck. A practical threshold: below five concurrent sessions, a terminal tab and your own review beat any orchestrator; above that, state tracking earns its keep.
Do I need git worktrees to run multiple AI coding agents?
Not strictly, but they are the cheapest isolation available. Each worktree gives an agent its own checkout, and a trial merge between branches surfaces real file overlap before either agent finishes. The honest limit: worktrees isolate edits, not intent, so two agents can still build conflicting designs that merge cleanly.
What is the cheapest way to orchestrate coding agents on a small team?
Spend the minute per task running the dependency test in your head instead of buying tooling. If tasks share files, tests, or ordering, sequence them; otherwise parallel runs are safe without an orchestrator. Coordination overhead only pays off at five or more concurrent sessions, multi-repo spans, or heavy merge volume.