Scheduling and Queuing Parallel Agent Jobs in CI Pipelines
AI-generated pull requests overwhelm traditional CI queues; here's how to redesign them.

Coding agents have changed what a pull request is, and that change is breaking the pipeline infrastructure most teams still run. An agent doesn't wait for a developer to sit down and write code; it opens pull requests on its own schedule. The volume of CI-triggering events a team produces is no longer tied to how many people are on the payroll. Teams running coding agents see their PR volume climb to several times the baseline of teams that don't, so an agent-enabled team of a dozen engineers can generate the CI traffic of a much larger organization. The classical CI queueing model was built around human commit cadence: a handful of pushes per developer per day, spread out over working hours, with predictable lulls at night and on weekends. Agents don't respect that rhythm. An overnight batch run or a burst triggered from Slack can open dozens of PRs in a single stretch, and the queue strategies written for human cadence have no way to absorb that.
The gap appears first in concurrency settings, which were configured once, usually at the organization or billing level, with no distinction between a job a person triggered and a job an agent triggered. The failure doesn't look like an outage. Builds don't fail; they simply wait, often without any signal to the developer about why. That silence is corrosive in a way an outage isn't, because an outage gets noticed and fixed, while a slow, unexplained queue just teaches developers that the CI system is unreliable, and they route around it or stop trusting its results.
Concurrency caps
A concurrency cap is a blunt instrument. It enforces a hard limit at the account or organization level, not per workflow and not per job type, so a long-running agent job that takes ten minutes competes for the same slot as a 90-second human lint check. The cap doesn't distinguish between the two, and it doesn't prioritize the quick job over the slow one. The cap just counts concurrent jobs against a number, and it queues whatever comes next.
Parallelism compounds the confusion because it doesn't lower the total amount of compute a team pays for. If twenty jobs each take 35 seconds, they bill as twenty full minutes, not twenty times 35 seconds, so splitting aggressively to save time can quietly inflate cost.
None of this is a bug in any vendor's system. It's the designed behavior of infrastructure built for a different load pattern. It was chosen before agents existed on the team, so now that static number is the ceiling every agent batch runs into.
The long-tail problem: why naive parallel splitting wastes slots without reducing wait
When you don't spread the work evenly across the parallel slots you add, the wait doesn't get shorter. Wall-clock time is set by the slowest bucket, not the average, so nine fast buckets can finish in seconds while everyone waits on the tenth.
Agent-generated jobs make this worse because their duration spread is far wider than a typical test suite's. Queuing a batch like that into a pipeline built for evenly sized human commits means some jobs finish almost instantly while others sit mid-run, holding a slot, long after the fast jobs are done.
Timing-based splitting is the fix the industry has already built for this exact problem in test suites: size each bucket by historical duration instead of file count, so every parallel slot runs for roughly the same wall-clock time. Agent jobs queued from a cloud platform need the same discipline: duration history, not job count or file count, should decide how work gets grouped. Past a relatively small number of parallel jobs, coordination overhead and the long tail eat into the wall-clock savings you were running things in parallel to get, so more slots stop helping and just add complexity.
Job prioritization: keeping human-initiated builds from starving behind agent batches

The scheduling rule that matters most in an agent-heavy pipeline is simple to state: a human-initiated build should never wait behind a batch of agent-generated jobs. A developer pushing a fix or a release pipeline firing is a person blocked in real time, while an agent batch running in the background is not blocked by anything at all; it will finish when it finishes. A single undifferentiated queue treats both as equally urgent, making the system adversarial to the people it's supposed to serve.
The fix is to separate queues by trigger source at dispatch. Buildkite's agent tagging lets teams label agents by job type, queue=agent-batch versus queue=human, and pipelines declare which tag they require, so human jobs only land on agents reserved for human jobs, as long as the pipelines are configured to ask for the right tag. On Jenkins, the Throttle Concurrent Builds plugin caps how many concurrent jobs can hold executors at once; without that cap, a large agent batch can consume every executor on a host and trigger the timeout behavior that parallel stages are supposed to prevent.
What makes this tractable is that trigger source is known at dispatch time, not discovered after the fact. Whether a job came from a human push, a webhook fired from Linear or Slack, or an agent opening its own PR is metadata available the moment the job enters the system. If platforms expose that metadata in pipeline conditions, you can assign priority before the job ever touches a queue, instead of reordering a queue after congestion has already built up. Replicas' own integration model, where agents are triggered from a dashboard, from Linear, or from a webhook, makes that trigger source explicit at the point of dispatch, which is the architectural piece that makes priority-based routing possible.
The mistake to watch for is implicit priority: assuming that because agent jobs were submitted first, they should run first. Every major CI system bakes in that default behavior, and it's the direct cause of human builds starving behind agent batches. First-in-first-out is a reasonable default when all jobs matter equally. It's the wrong default the moment an agent can submit fifty jobs before a single developer submits one.
Concurrency caps as a deliberate policy, not a billing default
A concurrency cap sized for human commit cadence doesn't age well once agents enter the picture, because agents produce PRs at multiples of a human developer's rate and the cap was never built to account for that multiplier. You shouldn't just bump the number when someone notices queues getting long. The cap should be treated as an active scheduling parameter that teams revisit deliberately, tied to actual PR volume and job mix, not as a billing line item that only changes when a vendor raises a tier price.
A static cap and dynamic scaling apply the same idea at two different time scales. If a team sets a static cap deliberately, it can cover the predictable baseline load. Dynamic scaling handles what happens above that baseline, when an agent batch run opens two dozen PRs overnight and creates a burst. The Azure Autoscaler community tool shows how this works in practice: it watches queue depth through the Azure DevOps API and adjusts the purchased parallel job count in real time, for both hosted and self-hosted pools. The baseline cap and the dynamic layer aren't alternatives to choose between; a team needs both, one for the steady state and one for the spikes.
Azure DevOps' parallel job model allocates one slot per concurrent job, shared across every project in the organization, which makes org-level budgeting unavoidable: an agent batch running in one project competes directly with a release pipeline running in another, even if the two have nothing to do with each other. Teams running active coding agents should treat each agent as a fractional additional user when sizing capacity, scaled by how many PRs that agent produces relative to an average human developer, rather than leaving the four-to-five ratio untouched as agent adoption grows.
Environment isolation: why each agent job needs its own sandboxed VM
Beneath the scheduler, each job must actually run in a clean environment. Parallel agent jobs sharing an environment are not independent of each other: leftover files, leaked environment variables, and stray processes from one job contaminate the run after it, producing failures that occur intermittently, resist reproduction, and never register with a concurrency cap because the cap only counts slots, not contamination.
The rule that holds up under agent load is strict isolation with a hard lifecycle: each agent job runs in its own environment, scoped to a single task, created when the job starts and destroyed when it ends, never reused across jobs or across agents. Replicas implements the same principle as a platform feature, running each agent in its own isolated VM pre-loaded with the team's dependencies, which is the sandbox-per-job pattern applied directly rather than left as a design choice each team has to build on its own.
If multiple agent harnesses share a pipeline, isolation becomes even more necessary. A team running Claude Code for refactors, Codex for batch lint fixes, and Opencode for model-agnostic tasks needs consistent sandbox configuration across all three, because an unsandboxed job sitting in a mixed queue can affect the environment that a properly sandboxed job later inherits. Buildkite's agent locking mechanism handles one narrow version of this problem, preventing commands like docker prune from colliding when two agents try to run them on the same host at once, but locking is advisory. It coordinates access, but it can't give each job its own environment from the start.
Routing agent jobs by type: matching job characteristics to pool configuration
Agent jobs don't all need the same infrastructure, and routing them as if they do wastes capacity in both directions. A lint fix needs almost no compute and a short time-to-live. A dependency upgrade has to install packages, run a full test suite, and verify the result before it's done, and that can take many minutes. A browser-based end-to-end test needs a full display environment that neither of the other two requires. Sending all three to the same undifferentiated pool means the pool has to be provisioned for the heaviest case even when it's mostly running the lightest one, and that mismatch is as wasteful as routing every job through a single priority queue regardless of who triggered it.
The fix is the same kind of tagging used for human-versus-agent priority, applied one level deeper: separate pools for fast-turnaround agent tasks, medium-complexity tasks, and long-running tasks, each sized and configured for what it actually needs. An overnight batch of dependency upgrades shouldn't hold compute that a daytime stream of quick lint fixes needs to stay responsive, and splitting the pools by job type is what keeps the two from competing.
Harness and model differences belong in this same routing layer, so you shouldn't scatter them across individual pipeline files. Codex CLI documents sandbox modes, read-only, workspace-write, and danger-full-access, that function as per-job configuration decisions, and the pipeline-design-time choice of which mode a given job type gets is a pool-routing decision, not something to hardcode into each workflow file separately. The broader principle is that routing should be harness-agnostic: the pool configuration should ask what kind of job this is and what it needs, not which tool happened to produce it. A structural choice underneath this is whether to parallelize at all for a given workload, which produces a different tradeoff depending on the job. If a test suite has thousands of independent unit tests, you gain from splitting it across many small jobs. A serial database migration or a long compile step has no independent work to split, so it runs better on one larger runner instead.
Measuring whether the scheduling strategy is working
The signal that a scheduling strategy is failing is queue time: whether human-initiated builds stay near zero wait, no matter how much agent batch load runs alongside them. That's the number to watch after any change to caps, pools, or priority rules, because it's the one metric that reflects whether the separation between human and agent traffic is actually holding under load.
Traditional CI metrics don't capture what matters once agents are producing a meaningful share of PR volume. Thirty-day merge rate is a more useful indicator than how many PRs are sitting in flight at any given moment. Reviewer-hours per merged PR is the metric that answers the harder question: whether agent output is actually reducing the work humans have to do, or just producing more work in a different form.
None of these numbers mean anything without attribution at the job level: which harness ran a given job, on which model, consuming how many compute-minutes, triggered from which integration. Replicas provides per-minute attribution down to the source, the person, the harness, the model, the credential that paid for the run, and the skills and MCP servers the agent reached for, giving scheduling decisions a measurable basis.
When you break pool utilization down by trigger source, human push versus agent batch versus scheduled run, you get the number that tells you whether your pool boundaries are drawn correctly. The loop that keeps all of this working is continuous: observe queue times by trigger source, find which pool or priority rule is causing a given build to starve, adjust the cap or the routing, and observe again. Teams that build this loop into their operating routine can keep tuning scheduling policy as agent adoption grows, instead of waiting for a developer's complaint to be the first sign that something broke.


