Skip to main content
AutoPilot for CI chooses the runner each GitHub Actions job runs on. You add a routing job to a workflow, and it asks CostGraph which runner fits each job best. CostGraph records each choice and its reason, and measures the job’s cost and time after it finishes.
AutoPilot for CI is free during preview. It routes between GitHub-hosted runners and runner providers such as Blacksmith, Depot, Ubicloud, Namespace, WarpBuild, RunsOn, Jog, and Avrea.

Requirements

  • Your GitHub organization is connected with the CostGraph GitHub App, with the repository Actions permission set to Read and write. AutoPilot uses it to cancel and re-run a run whose routed job never gets a runner. Until an organization owner approves it, every job keeps its default runner.
  • The job has run successfully at least once in the last 30 days. A job with no runs yet can still be tried on a cheaper runner.
  • The routing job can sign in with GitHub OIDC or a CostGraph API key with the ci:route scope.

Add the routing job

The following workflow routes build and keeps lint on a fixed runner.
.github/workflows/ci.yml
Every job whose runs-on reads the runners output is routed. The label after || is that job’s default runner. For a single job, read the runner output instead. The action’s README lists every input and output. Give the routing job the smallest runner you have, because it runs on every workflow run. Route jobs that run for several minutes on a costly runner, such as builds, test suites, and image publishing. A job that finishes in about a minute rarely saves more than the routing job costs, so keep it on a fixed runner.

Verify a routed job

Run the workflow and open the routing job’s log in GitHub. It lists the runner selected for each job and the reason for that choice. In CostGraph, open AutoPilot > CI > History. Choose a period that includes the run, then find its repository and workflow. Inspect the runner, cost, duration, and routing outcome. The Savings tab compares completed jobs with their usual runners and includes the routing job’s cost in Net saved. Keeping the default runner is a valid result. Check the routing reason before changing the policy. No better candidate, an unconnected provider, and a fallback are different outcomes, even when all three use the same runner.

Fallback

The routing job does not block a workflow. Every job gets its default runner when CostGraph does not answer within 3 seconds, returns an error, or rate limits the request. The same applies when AutoPilot is off or paused, and the routing job stays green. The timeout-minutes, if: ${{ !cancelled() }}, and || default in the example keep the jobs running even when the routing job cannot start. Set fail-on-error: true on the action to fail the routing job instead. A missing subscription always fails the routing job, with a link to set up billing. The routing job’s log lists why each job got its runner.

Runners AutoPilot can choose

AutoPilot can choose GitHub-hosted runner labels and every runner of a provider connected to CostGraph. It can also choose runners you turn on in settings, and runners on your own Kubernetes cluster. It never chooses a label blocked in settings. The runner must match the job’s operating system and architecture, with at least as many vCPUs and enough memory.

Policies

Each workflow follows one policy. The default is balanced. Time is the 75th percentile of queue plus run time over the last 30 days. Cost comes from each provider’s published price, after any included minutes you have left. For a runner the job has not run on, CostGraph estimates the time from public benchmarks.

Try new runners

AutoPilot tries a runner once for a job before it trusts it. One trial runs at a time for each job and runner. After a trial passes, your policy picks between that runner and the others. A failure affects only the job that failed. AutoPilot skips a runner for a job for one hour after a failed trial. It does the same after 5 failed runs of that job within an hour. A run that cost more than the default runner, or was more than max(5 s, 10%) slower, counts as failed. Other jobs keep using the runner. A price drop ends the skip early. AutoPilot skips a provider for every job only when it is offline. That means its latest runner never started, for example because it could not be created. The provider is used again after one of its runners starts a job. When a provider has a temporary fault, CostGraph retries it after 30 seconds and again after 2 minutes, then uses the default runner. The History tab shows a chip on a run that left its runner. Hover it for the provider’s own error.

Re-run failed jobs

When you choose Re-run failed jobs in GitHub, AutoPilot chooses the runner again for jobs on runners CostGraph starts, such as a sandbox. The job moves to the next best runner when its runner broke or when the job failed there but passes on its default runner. A job whose own steps failed stays on the same runner.

Pin a workflow to a provider

Set pin when a workflow must run on a given provider, for data residency, a contract, or credits. A pin is also how you send a workflow to a hosted sandbox such as Beam, Fly, or Microsandbox.
Each pin entry is a provider such as ubicloud, a runner label such as ubicloud-standard-8, or a size written <provider>:<size>. AutoPilot then considers only the pinned runners with at least the default runner’s vCPUs and memory, and the policy picks among them. A pinned runner does not have to beat the default runner, so a pinned run can add cost in Savings. The default runner stays the fallback when no pinned runner fits or picks the job up. You can also set a pin for the organization, a repository, or a workflow in AutoPilot for CI settings. The pin input in the workflow file takes precedence.

Measure job usage

AutoPilot shows the CPU, memory, disk, and network each job uses. Runners that AutoPilot launches measure each job without setup. For other runners, add the usage step as the first step of the job and give the job permissions: id-token: write.
A permissions: block turns off every permission it does not list, so keep the ones the job already uses. The step never fails the job. It measures nothing on macOS or Windows, in pull requests from forks, or in Alpine-based container images.

Stuck jobs

AutoPilot cancels a run when a routed job is still waiting for a runner after its deadline. It re-runs the run with every job on its default runner. The deadline is the provider’s 95th percentile queue time plus one minute, and at least 90 seconds. AutoPilot leaves the run alone when any of its jobs has started work. It never cancels release and deploy jobs.

Secrets and forks

Runner providers receive jobs with their secrets by default. To keep jobs that use secrets off a provider, set allow_secrets: false for it. Pull requests from forks and pull_request_target runs always use their default runners.

Sign in with GitHub OIDC

The routing job can sign in with the workflow’s own GitHub identity, so you store no CostGraph key in the repository. Give the job permissions: id-token: write and leave api-key empty. CostGraph returns a token that lasts at most an hour and covers only that repository. Use an API key with the ci:route scope on self-hosted runners that cannot request OIDC tokens.

Self-hosted installations

On a self-hosted installation, set api-url to your dashboard address on the routing job and on the usage step. GitHub OIDC sign-in then requests that address as its audience.
AutoPilot for CI needs a GitHub App that belongs to your installation. Connect GitHub for AutoPilot for CI describes how to create it.

Savings

CostGraph compares every routed job with the same job on its default runner. The baseline is the 75th percentile cost and time over the 30 days before AutoPilot first routed the job. Savings count what each routed job actually cost and how long it took. A job that cost more than its baseline counts as added cost, and the routing job’s own cost is subtracted from the total.