---
title: "Sandboxes for coding agents: warm repos, ready in milliseconds"
description: "Promigence runs coding agents in sandboxes forked from a verified, already-built snapshot of the repo, so every step starts warm and a twenty-step task finishes in about a minute."
url: "https://www.promigence.ai/for/coding-agents"
site: "Promigence"
---

# Coding agents that start work on a repo that is already built

Promigence gives a coding agent a sandbox forked from a verified snapshot of the repository, with dependencies installed and the build done. The agent starts at a built tree instead of a git clone, so its edit-and-check loop runs at warm speed from the first step.

**Who this is for:** Teams building coding-agent products and software factories that run agents against customer repositories.

## What breaks today
### Every task starts with a clone and an install
Before an agent writes a line, it waits for the repository to download, the dependencies to install and the first build to finish. On a real repository that is minutes, paid again on every task.

### Each check in the loop is a cold build
An agent that edits, type-checks and edits again pays the cold price on every check. A type-check that takes 24 seconds cold sets the pace of the whole loop.

### Your users watch the spinner
The wait is theirs. A task that takes nine minutes loses the person who asked for it.

## What changes with Promigence
### Start from a built snapshot
Build the repository once, with a verify command. Every sandbox forks from that result, so the agent's first command runs against an installed, built tree.

### Warm checks at every step
The type-check that costs 24 seconds on a cold machine costs 1.5 seconds on a warm fork, so a twenty-step task finishes in about a minute instead of nine.

### A sandbox per task, as many as you need
Fork one per task. Each is isolated, and one that sits idle can pause itself until it is needed again.

## One snapshot per repo, one fork per task
```bash
# Once per repo, or when the lockfile changes
promigence snapshot create --image node:22 \
  --setup "git clone https://github.com/your-org/app /work/repo && git -C /work/repo checkout <40-char sha>" \
  --setup "cd /work/repo && npm ci && npm run build" \
  --verify "cd /work/repo && npm test" --alias app --wait --wait-timeout 10m

# Per task: a warm sandbox, then your agent's commands
promigence fork --snapshot app --count 1 --cap 1
promigence exec --sandbox "$SANDBOX" -- sh -c "cd /work/repo && npm run typecheck"
```

## What is the best sandbox for running AI coding agents?

Pick the sandbox that keeps the agent's edit-then-check loop short, because a coding agent checks its work dozens of times in one task and starts only once. Four things decide that: the repository already installed and built when the agent arrives, checks that run where the code lives, a separate sandbox for every task, and a spend limit agreed before the work begins. On Promigence, each task gets all four from a snapshot of your repository that passed your own test command.

## How it works

### Build the repository once

Pin a commit, list the install and the build as setup steps, and give the snapshot your test command as its verify step, the way the example above does. A build that fails its verify step is never stored, so no agent opens on a broken tree. That build costs at most $0.17 at the default small size, charged by the second for as long as it runs.

### Start an agent in its own sandbox

Any of Claude Code, Codex or OpenCode starts with one command. `--key-from-env` saves the model key as a Promigence secret before anything runs, so the value never lands in shell history or a process listing, and `--cap` is the most that sandbox may spend in US dollars. To open the agent in your built tree, start it from the snapshot's alias instead; the Claude Code guide shows that form.

```bash
export ANTHROPIC_API_KEY=...        # already set in most setups
promigence agent start claude --key-from-env ANTHROPIC_API_KEY --cap 2
```

### Try several approaches at once

Some tasks deserve more than one attempt. Install once in one sandbox, take a snapshot of it while it runs, then start copies from that snapshot: each begins with the dependencies in place and writes only to its own files. `promigence run` hands every copy its own index and prints a report of which attempts passed, with any environment failure kept apart from the attempt's.

```bash
SID=$(promigence fork --count 1 --cap 1 --timeout 30m --fresh --json | jq -r '.sandboxes[0].sandbox_id')
promigence exec --sandbox "$SID" --timeout 15m -- \
  sh -c "git clone --depth 1 https://github.com/your-org/your-app /work/app && cd /work/app && npm install"
promigence sandbox snapshot "$SID" --alias app-installed --move-alias
promigence sandbox kill "$SID"

promigence run --snapshot app-installed --count 10 --cap 3 --timeout 20m \
  -- sh -c 'cd /work/app && ATTEMPT=$PROMIGENCE_INDEX node agent.js && npm test'
```

### Let the agent on your laptop drive sandboxes

Going the other way, Claude Code on a developer's machine can start sandboxes, run commands in them and read their files once the CLI is registered as its MCP server. The `--cap` after `promigence mcp` limits what each sandbox it starts may spend. When the server stops, so do the sandboxes that session started.

```bash
claude mcp add promigence -- promigence mcp --cap 1
```

## What you get, in numbers

| What | Result | Conditions |
|---|---|---|
| Agent step on a warm repository | 0.66 s | An edit, then a type-check, on 4 vCPU; median of 30 runs, 0.80 s under load [Source](https://www.promigence.ai/#numbers) |
| 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) |
| 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) |
| 20 copies of a warm workspace | 1.41 s | All 20 usable; median of 3 rounds [Source](https://www.promigence.ai/#numbers) |

## What it costs

One agent task in a medium sandbox (4 vCPU, 16 GiB, the size the agent-step figure was measured on), given a 30-minute timeout and a $0.50 cap.

1,800 s × $0.000128 per second = $0.2304. That figure is the quote: what the task would cost if the sandbox ran for its whole timeout.

Total: at most $0.23 for the task, and under eight cents (600 s × $0.000128) if the agent finishes in ten minutes.

A start quoted above its cap is refused before anything runs, and a sandbox that hits its cap pauses with its files intact. Your model provider bills the agent's tokens separately.

## Security and limits

- A secret enters the sandbox only at run time, and the snapshots you build never hold one unless you force it.
- Your code, your agent's outputs and your test results are not used to train models.
- You can delete a snapshot of your repository whenever you like, and what a task changes is discarded unless you keep it.

## Related

- [Run Claude Code, Codex or OpenCode in a sandbox](https://www.promigence.ai/docs/guides/claude-code-and-codex)
- [Snapshot after npm install, then fork 10 copies](https://www.promigence.ai/docs/guides/snapshot-and-fork)
- [Time to feedback: the delay that matters for coding agents](https://www.promigence.ai/blog/time-to-feedback-coding-agents)
- [Give every user of your product their own sandbox](https://www.promigence.ai/docs/guides/sandbox-per-user)
- [Quickstart](https://www.promigence.ai/docs/quickstart)

## Questions

### Does sandbox start time matter for a coding agent?

Start time matters far less than the time each check takes. A task starts once and runs its edit-then-check step dozens of times, so a slow check costs more over a whole task than any start. Time the step first.

### Which coding agents can run in a Promigence sandbox?

`promigence agent start` launches Claude Code, Codex or OpenCode, and installs the agent in the sandbox if the snapshot does not already have it. Any other agent can work there through the CLI, the TypeScript and Python SDKs or the REST API.

### How does an agent work on a private repository?

Through a GitHub connection you make once, with `promigence github connect`. The snapshot is built from the private repository with its dependencies installed and a check that must pass, and every agent started from it opens in the same verified tree.

### How do you keep the model key safe?

Store it as a secret and never type it on a command line. `--key-from-env` reads the key from an environment variable and saves it for later runs. Secret values are removed from logs and outputs.

### Can an agent try several fixes for the same task?

Yes. Snapshot a sandbox after the install, start as many copies as the task is worth, and keep whichever one passes its tests. No copy can touch another's files.

### What stops a runaway agent?

Its spend cap and its timeout, whichever comes first. Both are set when the sandbox starts; without `--cap`, your organization's default cap applies. A sandbox stopped by its cap keeps its files, so you can inspect what the agent did.

### Can my coding-agent product give each of its users a separate sandbox?

Yes, one per user, found again on that user's next message and paused when they go quiet. The guide on giving every user their own sandbox has the code in TypeScript and Python.

