Skip to content
mentoor

Topic 5 of 5 · 5 min read

When parallel agents slow you down

Goal: Decide whether a set of tasks should run in parallel or in sequence, given their coupling and the review capacity.

Run tasks in parallel only when they are independent and you can review them all; when they are coupled or you are the bottleneck, doing them one after another is faster in practice.

Check yourself · 1 of 3

Which pair of tasks is the best candidate to run in parallel?

Choose one answer

Why it matters

Parallel agents feel productive because many terminals are busy. The real measure is how soon correct, reviewed code reaches main. Extra sessions add costs: conflict resolution, context switching, re-running work that was built on a wrong guess, and waiting in your own review queue. When those costs exceed the time saved, the parallel plan is slower than a single agent working through the list.

How to do it

Score each set of tasks on four questions before you start.

  1. Coupling. Do the tasks change the same files, the same contract or the same behaviour? If the answer to the second task depends on the first, run them in order.
  2. Shared state. Do they use the same database, queue, test environment, external API quota or deployment target? If it cannot be separated, they will interfere.
  3. Review load. Can you review all the output properly, within your budget? If not, start fewer.
  4. Cost of a wrong start. If task one might change the design, work started in parallel on the old design is thrown away.

When you are unsure, start one agent, look at the plan it proposes, and decide then. A good split is cheap to run and obvious to explain; if you struggle to explain it, it is probably coupled.

Before and after

Weak: a team rewrites an authentication layer, and in parallel starts three agents on features that all call the authentication layer. Each feature agent guesses at the new interface. Every one is rebuilt after the rewrite lands.

Fixed: run the authentication change first, merge it, then start the three feature agents against the real interface.

Tasks Coupled? Shared state? Verdict
Docs update, new report page No No Parallel
Rename a core type, add a feature using it Yes No Sequence
Two jobs that both need the single staging database No Yes Sequence, or separate databases
Five unrelated bug fixes, one reviewer No No Run two or three, not five

What goes wrong

  • Parallelising a refactor. Sweeping renames and structure changes touch everything, and every other branch conflicts with them.
  • Clashing resources. Two agents that run heavy builds or hit one rate-limited API slow each other, or the machine itself.
  • Hidden dependencies. Tasks look separate in the ticket but share a helper in the code.
  • Counting agent time, not your time. Ten finished diffs waiting for you is not ten finished tasks.

Examples

Refactor first, features after

A team plans to rename the Customer type across the codebase and add two features that use it. They run the rename alone, merge it, and then start both feature agents. The features never have to be rewritten against a moved target.

One staging database

Two agents each need to run end-to-end tests against the single staging database. Each run wipes and reseeds it. Either each gets its own database, or the two jobs run one after the other.

Key points

  • Parallel is faster only when tasks are independent and the reviewer can keep up.
  • Tasks that change the same files, contract or behaviour should run in sequence.
  • Shared databases, queues, API quotas and test environments must be separated, or the tasks must run one at a time.
  • Big refactors and renames conflict with everything, so run them alone and merge them first.
  • Measure success by reviewed code merged to main, not by how many sessions are running.

Common mistakes

  • Treating every task list as parallel work because the tool allows it.
  • Running a refactor alongside feature work that touches the same code.
  • Ignoring shared databases, API quotas and machine load.
  • Counting finished agent output as progress before it is reviewed and merged.

Check yourself · 2 of 3

A task may change the design that three other tasks depend on. What is the best plan?

Choose one answer

Check yourself · 3 of 3

Ten agents have finished ten diffs and you are the only reviewer. What does this show?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic