Buildkite agent reference architectures

This page compares four reference architecture patterns for running Buildkite agents, from a small initial setup to a multi-cluster enterprise fleet. Each pattern describes a typical combination of agent compute, queues, caching, workload isolation, and operational ownership.

The Starter, Growth, Scale, and Enterprise names are convenience labels used only on this page. They are not official Buildkite architecture names, product tiers, or required stages. Your architecture can combine elements from more than one pattern.

Choose the simplest pattern that meets your current requirements. Add complexity when recurring queue delays, workload conflicts, security boundaries, or fleet management work show that the current design no longer fits.

Buildkite hosted agents fit into every pattern. In a small setup, they can replace self-managed CI infrastructure entirely. In larger setups, they run alongside self-hosted agents and take on workloads such as macOS builds or extra capacity.

Which reference architecture should you choose

Use build volume and team size as initial indicators, then make the decision based on workload diversity, isolation requirements, and operational capacity:

  • Starter: Use Buildkite hosted agents, one VM, or a small auto-scaling group when one team has similar workloads and needs little infrastructure specialization.
  • Growth: Add separate queues and shared caching, running on Buildkite hosted agents or auto-scaled VMs, when queue contention or different credential boundaries become recurring concerns.
  • Scale: Use workload-specific agent pools and centralized fleet management when teams need different operating systems, architectures, accelerators, or compliance controls.
  • Enterprise: Use multi-cluster Kubernetes infrastructure, with Buildkite hosted agents for the workloads they suit, when you need per-job isolation, regional resilience, detailed cost attribution, or platform-level service objectives.

Treat these recommendations as starting points rather than thresholds. A smaller organization with regulated workloads might need stronger isolation, while a larger organization with uniform workloads might not need Kubernetes.

Architecture comparison

The following ranges show the environments that each pattern commonly fits. They are guides, not limits or Buildkite service requirements.

Dimension Starter Growth Scale Enterprise
Dimension Team size Starter 1–15 engineers Growth 15–60 engineers Scale 60–250 engineers Enterprise 250+ engineers
Dimension Daily builds Starter Under 200 Growth 200–2,000 Scale 2,000–20,000 Enterprise 20,000+
Dimension Agent compute Starter Buildkite hosted agents or a single VM Growth Buildkite hosted agents or auto-scaled VMs Scale Hosted and self-hosted pools per workload Enterprise Kubernetes clusters alongside Buildkite hosted agents
Dimension Queue strategy Starter Single queue Growth 2–3 queues Scale Per-workload queues Enterprise Dynamic routing with tags
Dimension Caching Starter Built-in caching Growth Buildkite Cache Scale Buildkite Cache and Git mirrors Enterprise Buildkite Cache, persistent volumes, and remote Git mirrors
Dimension Operational complexity Starter Low Growth Moderate Scale High Enterprise Very high

Should your agents be ephemeral or persistent

Decide early whether each workload needs a clean environment for every job, or local state that persists between jobs. This choice affects which compute options fit, whichever pattern you use.

  • Ephemeral agents: Each job runs in a fresh environment that is destroyed when the job finishes. Choose ephemeral agents when you want clean, reproducible builds with no state carried between jobs and a shorter window for an attacker to compromise the build environment. Buildkite hosted agents are always ephemeral, and the Agent Stack for Kubernetes runs each job in its own pod. To avoid starting each job cold, restore dependencies with Buildkite Cache or, on hosted agents, cache volumes.
  • Persistent agents: Agents keep local state, such as build outputs, disk caches, and checkouts, between jobs. Build systems such as Bazel and Pants rely on this state for fast incremental builds. Choose persistent agents when rebuilding or restoring that state for every job costs more time than it saves.

Buildkite hosted agents are designed for ephemeral workloads. Cache volumes carry data between hosted jobs on a best-effort basis, but they don't guarantee the warm local state that tools such as Bazel and Pants expect. Run these workloads on self-hosted agents that keep their state between jobs, and route them to their own queue. For example, instances in the Elastic CI Stack for AWS keep running between jobs until the stack scales in, unless you terminate each instance after its job. Pair persistent agents with a remote cache, so that a replacement instance doesn't start cold. See Bazel caching for remote cache options.

Starter pattern

The Starter pattern suits a single team with similar workloads and limited isolation requirements. It prioritizes a small operational footprint over specialized routing or high throughput.

Avoid adding Kubernetes, multiple queues, or custom hooks before the workload requires them. A flat setup is easier to operate and diagnose.

When to move beyond the Starter pattern

Consider the Growth pattern when you see any of the following recurring conditions:

  • Build queue wait times regularly exceed two to three minutes.
  • A single flaky or runaway job can block the whole team.
  • You need to separate deployment jobs from test jobs for security or compliance.
  • You run more than one language or platform stack, and agents need different toolchains.

Growth pattern

The Growth pattern suits multiple teams that need more capacity or clearer workload boundaries. It adds auto-scaling, queue segmentation, and caching without requiring a container scheduler.

When to move beyond the Growth pattern

Consider the Scale pattern when you see any of the following recurring conditions:

  • Test parallelism demands exceed what one uniform agent pool can absorb cost-effectively.
  • Different teams need different agent environments, such as mobile builds, ML training jobs, or ARM64.
  • Queue wait times keep climbing despite larger VMs and higher scaling limits.
  • Compliance requirements demand stricter isolation between workload types.
  • Your platform team spends significant time managing the agent fleet.

Scale pattern

The Scale pattern suits organizations with diverse workloads, stronger compliance requirements, and a dedicated platform team. Different job types run in agent pools designed for their compute, toolchain, and isolation requirements.

When to move beyond the Scale pattern

Consider the Enterprise pattern when you see any of the following recurring conditions:

  • You run agents across multiple cloud regions or on-premises data centers.
  • Kubernetes is your standard compute substrate, and you want agents to live natively in it.
  • You need pod-level isolation between job executions for compliance, such as SOC 2, FedRAMP, or HIPAA.
  • Build infrastructure cost is a meaningful line item, and you need per-team or per-project cost attribution.
  • Your platform team runs agent infrastructure as a product, with SLAs and an internal customer base.

Enterprise pattern

The Enterprise pattern suits large or regulated organizations that operate multi-cloud, hybrid, or multi-region infrastructure. It uses multiple Kubernetes clusters, typically alongside Buildkite hosted agents, and requires a dedicated platform engineering function. This design supports high throughput, per-job isolation, regional resilience, and detailed cost controls at the cost of greater operational complexity.

Cost controls

The main cost controls at this scale are:

  • Run spot or preemptible instances for stateless jobs, which typically reduce cost by 60–80% versus on-demand for test workloads.
  • Right-size pod resource requests against historical job metrics, since bin-packing efficiency degrades when requests are over-specified.
  • Cache aggressively. At 20,000+ daily builds, even a 10-minute average reduction in job duration compounds to hundreds of compute-hours per day.
  • Include instance startup, idle, and shutdown time when you compare self-hosted and hosted costs. Self-hosted cloud instances usually accrue charges during these periods. Usage of Buildkite hosted agents is billed in vCPU minutes of job runtime, excluding startup and shutdown periods, with no minimum charges. For fleets that run large numbers of short jobs, this overhead can be a material part of total compute cost.
  • Attribute cost per team using Kubernetes labels and cloud cost allocation tags. Teams that see their build cost tend to optimize it. If you also run EC2-based agents with the Elastic CI Stack for AWS, see Attributing AWS agent costs for a separate approach that correlates agent events with hourly instance pricing.

How should you apply these patterns

Do not treat these patterns as a required progression. Start with the least complex design that satisfies your workload, security, and reliability requirements. Adopt individual elements from another pattern when you can define the problem that the added component will solve.

Use recurring operational signals rather than one-off incidents to justify a change. Define a success criterion, such as reducing p95 queue wait time below 60 seconds or isolating production credentials from test jobs, before changing the architecture.

Use these questions to check the fit:

  • Does one team run fewer than 200 similar builds each day? Start by evaluating the Starter pattern.
  • Do queue contention or security boundaries affect a workload that is growing beyond 200 daily builds? Evaluate the Growth pattern.
  • Do mobile, web, machine learning, or security workloads need different compute, and does a platform team manage the fleet? Evaluate the Scale pattern.
  • Do Kubernetes, multi-region availability, per-job isolation, or compliance requirements shape the infrastructure? Evaluate the Enterprise pattern.
  • Do some builds depend on warm local state, such as Bazel or Pants caches? Run those builds on persistent self-hosted agents, as described in Should your agents be ephemeral or persistent.
  • Do several answers apply? Combine the relevant components, and keep queue ownership and security boundaries explicit.

Whichever pattern you choose, plan regular agent upgrades so your self-hosted fleet stays on a supported release line. Buildkite manages agent versions on hosted agents. See the Buildkite agent version support policy for support windows.

For guidance that applies across all four patterns, see Agent management best practices.