← Blog

How many agents can one main branch take?

Gudjon Gudjonsson · Founder and CEO of OZ · 15 September 2026

Every team that runs a fleet of coding agents asks the same question. How many agents can share one main branch? The answer depends on one number more than any other: how long your checks before a merge take. This post shows the arithmetic, so you can do it for your own fleet. All numbers here come from bay's design, not from measurements.

The limit is merges, not machines

Each main branch takes one merge at a time. Each merge waits for its own check, on the exact candidate that will merge. When main moves under a check, bay rebuilds that change and checks it again. After two such moves, the change joins a queue, and bay checks only the head. So one main branch takes at most 1,440 merges a day, divided by your check minutes. With 12-minute checks, that is 120 merges a day.

Leave headroom

Do not plan for a queue that is always busy. The wait in a single queue grows fast above about 70% load. Bursts, retries and outages need room. We also add about 15 seconds per merge for fetch, signing and push. That overhead is an estimate.

The rule of thumb

Agents per main branch ≈ 1,440 × 0.7 ÷ ((check minutes + 0.25) × merges per agent per day). Agents that work on long tasks and merge rarely raise the ceiling. Agents that merge small commits all day lower it.

Check before a mergeUsable merges a dayBusy agents (17 merges a day)Agents on long tasks (5 a day)
12 min~82~5~17
4 min~240~14~48
2 min~450~26~90
1 min~800~47~160

Estimates from bay's design at 70% load, with 15 seconds of overhead per merge.

Machines matter much later

Machines add load on the Git remote, not on the queue. Each running merge renews its lease every 10 seconds. Each machine also pushes a short summary of its live sessions. Every push reads the full list of refs, and that list grows with every merge. bay's design compacts merge markers into shard indexes to keep pushes fast. Fetches stay cheap, because each machine keeps one shared object cache.

We estimate tens of machines with no tuning, and low hundreds before the remote needs care. We have not measured the machine limit yet. Agents per machine depend on the CPU and memory your agents use, not on bay.

How to raise the limit, cheapest first

The first steps cost the least and raise the ceiling the most.

  1. Shorten the checks that must pass before a merge. Run the full suite after the merge, and fix forward.
  2. Split the work across main branches, one per repository or product area. Each one gets its own queue.
  3. Check several queued changes at once. bay does not do this today: it wastes checks when one fails.
  4. Batch changes into one candidate. bay does not do this today: a failed batch blames many changes.

How to set bay up

Start with numbers you can read today.

  1. Measure how long your required checks take, and how often each agent merges.
  2. Keep the checks before a merge short and deterministic. Move slow suites to after the merge.
  3. Give each area of code that rarely touches the others its own main branch.
  4. Run at least two runners, so a dead runner gets replaced.
  5. Watch push time as your ref count grows with merges.
  6. Track three numbers: queue wait, push time, and merges per agent per day.

What we will measure

Everything above rests on bay's design. We will replace these estimates with measured queue waits, push times and merge rates. We will release the method with the results, so you can run it on your own fleet.

Since then

Since bay 0.2.0, bay can check queued changes early, and check several as one batch. [runner] ahead checks queued changes on the main they will most likely meet. [runner] batch checks several queued changes as one tree, and splits a failed batch to find the culprit. Without batch, the limit is 1,440 merges a day, divided by the head's minutes for build, checks and push. With batch, one run merges up to max changes. Each needs a key registry that signs everything, or [policy] reuse_unsigned = true.

Gudjon Gudjonsson · Founder and CEO of OZ