---
title: "Agentic CI infrastructure, warm verified environments per pull request"
description: "Promigence gives agentic CI a warm verified environment per job, forked from a snapshot of your repo, with the cost of the run quoted and capped before it starts."
url: "https://www.promigence.ai/for/agentic-ci"
site: "Promigence"
---

# Agentic CI with a known cost before every run

Promigence gives every agentic CI job a warm environment forked from a verified snapshot of your repo, so an agent starts at a built tree rather than at a `git clone`. Most of an agent-heavy CI bill is repeated setup. Forking removes it, and a quote before each run keeps the monthly number predictable.

**Who this is for:** Platform teams running coding agents against their own repositories in CI.

## What breaks today
### Setup is most of the job
A five-minute agent task behind a ninety-second install is 30% overhead, paid on every job.

### The bill scales with enthusiasm
Agentic CI usage grows the moment it works, and per-second billing means the finance conversation happens afterwards.

### Flaky environments look like flaky agents
A dependency that fails to resolve at 3am produces a red build nobody can attribute, and trust erodes in the agent rather than the fleet.

## What changes with Promigence
### A snapshot per branch, rebuilt when the lockfile moves
So most pushes start from a snapshot that is already built and verified.

### Quote and cap per pipeline
Every workflow knows its ceiling before it starts, and a runaway loop is paused at the cap.

### Environment failures show up as environment failures
Red builds get a cause attached, which is the only way an agent-driven pipeline keeps anyone's trust.

## One step in a GitHub Actions workflow
```yaml
- name: Agent pass on the PR
  run: |
    promigence run \
      --snapshot app --secret ANTHROPIC_API_KEY \
      --count 1 --cap 0.50 --timeout 10m --json \
      -- sh -c "cd /work/repo && git fetch -q origin ${GITHUB_SHA} && git checkout -q ${GITHUB_SHA} && claude -p 'fix the failing tests in this diff'"
  env:
    PROMIGENCE_API_KEY: ${{ secrets.PROMIGENCE_API_KEY }}
```

## What tools let AI agents run and fix CI pipelines automatically?

Two pieces do it: an agent that can change code, such as Claude Code, Codex or OpenCode, and a place for each attempt to run with your repository already built. The second piece is what Promigence provides. A pipeline step starts a sandbox from your repository's verified snapshot, the agent works on the failing tests there under a spend cap and a timeout, and the step prints one JSON document the pipeline can act on. Each attempt's cost is quoted before it starts.

## How it works

### Build the snapshot the workflow names

The workflow step above starts from a snapshot called app. Build it from an image with two setup steps, a clone at a pinned commit and the install, plus your test command as the verify step. It is stored only if that command exits 0. Keep one path in both places: this example clones into `/work/app`, while the workflow step changes into `/work/repo`.

```bash
promigence snapshot create --image node:22 \
  --setup "git clone https://github.com/your-org/your-app /work/app && git -C /work/app checkout <40-char sha>" \
  --setup "cd /work/app && npm ci" \
  --verify "cd /work/app && npm test" \
  --alias app --wait --wait-timeout 10m
```

### Store the model key once

Because the step passes `--secret ANTHROPIC_API_KEY`, a secret of that name must exist before the first run. Store it once with `promigence secrets set` and `--from-env`, which reads the value from an environment variable rather than the command line. The pipeline itself holds only `PROMIGENCE_API_KEY`, as a repository secret.

### Know the ceiling before the job starts

`promigence run quote` prices a run before any sandbox exists, as if each one ran for its whole timeout. The step above sets `--cap 0.50` and `--timeout 10m`. A run whose quote tops its cap is refused outright, and if a sandbox hits that ceiling mid-run, it pauses with its files in place, so a looping agent stops costing money.

### Act on the result

With `--json`, the run prints one JSON document: what completed, what failed the task, what failed because of the environment, and the cost. Fail the job on a task failure. Retry on an environment failure, then pass the agent's diff to a person for review.

## What you get, in numbers

| What | Result | Conditions |
|---|---|---|
| Whole coding-agent task | 43.7 s | 20 steps on a 3 GB repository; median of 30 runs, 58.0 s under load [Source](https://www.promigence.ai/#numbers) |
| CI job, start to finish | 48.5 to 55.9 s | A clone, an install and a type-check at 4 vCPU / 16 GiB; median of at least 3 runs [Source](https://www.promigence.ai/#numbers) |
| Sandbox ready to run a command | 8 ms | From create to the first command at 2 vCPU / 4 GiB; median of 100 runs [Source](https://www.promigence.ai/#numbers) |

## What it costs

The workflow step at the top of this page, in a small sandbox (2 vCPU, 4 GiB) with its 10-minute timeout and $0.50 cap, run on 40 failing pull requests a month. The 40 is an example input.

Quote per run: 600 s × $0.000046 = $0.0276. A month in which every run used its whole timeout: 40 × $0.0276 = $1.10.

Total: at most $1.10 a month for the agent's sandboxes.

Each run's quote, under three cents, sits well inside its $0.50 cap. Building the snapshot costs at most $0.17 at small, billed by the second, and runs started from it pay no further build charge. The model's tokens are not in this figure: your model provider charges for those.

## Security and limits

- Anything over an account limit is turned down before it starts, and its error code names the limit along with the fix.
- A sandbox is never billed past its cap: it is paused when it reaches the cap, or stopped there if it cannot be paused.
- With Promigence Runners on, each CI job gets its own console page showing who started it, the commit, the runner's size and what the job cost.

## Related

- [Run Claude Code, Codex or OpenCode in a sandbox](https://www.promigence.ai/docs/guides/claude-code-and-codex)
- [A GitHub Actions runner in two lines](https://www.promigence.ai/docs/guides/github-actions-runner)
- [Snapshot after npm install, then fork 10 copies](https://www.promigence.ai/docs/guides/snapshot-and-fork)
- [Quickstart](https://www.promigence.ai/docs/quickstart)

## Questions

### How do I cap what an AI agent can spend when it fixes a failing CI job?

Put `--cap` and `--timeout` on the run that starts the agent. A run whose quote is over the cap never starts, and one that reaches the cap mid-run is paused rather than billed further. Limit the agent's own turns too, since the model's tokens are billed by its provider.

### Does the agent need the whole repository rebuilt on every job?

No. It starts from a snapshot that already has the install and the build done, and the step checks out the commit it was given inside the sandbox. Rebuild the snapshot when the lockfile changes.

### How does the pipeline tell a broken environment from a bad fix?

From the run's report. Environment failures are counted apart from task failures, so a red build caused by the environment comes with that cause attached.

### Can the CI job itself run on Promigence?

Yes. Turn CI on for the repository in the console, and one line, `runs-on: promigence`, moves a GitHub Actions job onto Promigence sandboxes; GitLab CI uses a runner tag. The runner guide covers both.

### Which agents can run in the pipeline step?

Any agent CLI your command can start inside the sandbox. The step on this page runs Claude Code in headless mode, and `promigence agent start` can install Claude Code, Codex or OpenCode for you.

### What happens when the agent cannot fix the tests?

The run reports a task failure and the job goes red like any other failing build. What the failed sandbox left stays reopenable for up to a week, so a person can run `promigence run open` and see what the agent tried.

