---
title: "RL environment infrastructure, verified environments at scale"
description: "Promigence runs reinforcement-learning environments for coding agents: verified before every episode, forked warm by the thousand, and quoted and capped before the run starts."
url: "https://www.promigence.ai/for/rl-environments"
site: "Promigence"
---

# Reinforcement-learning environments that cannot poison the reward

Promigence runs thousands of concurrent RL environments forked from one verified snapshot, each proven to work before the episode starts. A broken environment does not just lose you an episode: the optimiser treats its failure as real and the model learns from something that never happened.

**Who this is for:** RL environment vendors, data vendors, and labs' own post-training teams running coding agents.

## What breaks today
### A broken environment is a poisoned reward
The agent writes a correct patch, the environment failed to install a dependency, the test fails, and the optimiser updates on it. Unlike a wrong eval chart, this one is baked into weights.

### Concurrency ceilings you discover in production
Published accounts put real fleets capping at 300 to 550 concurrent, with orchestration the bottleneck past 256. A training step that needs 2,000 does not degrade gracefully, it stalls.

### Per-second billing on millions of episodes
At millions of episodes, cold setup is most of the bill, and you are paying it to run the same install over and over.

## What changes with Promigence
### Verification is a precondition, not a hope
No snapshot is stored that cannot pass its own test, and no fork is handed over cold. Environment failures are reported separately, so they never enter the reward signal.

### Fan-out designed for the training step, not the demo
A thousand forks for one training step start warm, not as a thousand cold installs.

### Volume pricing on committed capacity
Committed-use rates for sustained volume. Talk to us about running it in your own cloud account.

## A training step: environments verified, fanned out, capped
```python
from promigence import Promigence

client = Promigence()   # reads PROMIGENCE_API_KEY

# The quote for one training step, before anything starts
quote = client.runs.quote("task-suite", count=20, spend_cap=1.0)   # 20 at once

# Fan out the step: copies of one verified snapshot
run = client.runs.start(
    "task-suite", count=20, spend_cap=1.0,
    exec={"sh": f"python -m rollout --policy {policy_url}"},
)

# Environment failures apart from task failures, and what the step cost
report = client.runs.report(run["run_id"])
print(report["totals"], report["cost"])
```

## How do you run thousands of RL environments concurrently?

Start every rollout from one verified snapshot of the environment, give each its own copy, and drop the episodes whose environment broke before you compute the reward. The Max plan runs up to 500 sandboxes at once, or 1,000 at its $500 level; beyond that, an Enterprise contract fixes the limit and can hold capacity in reserve. Copies open where your setup left off, with nothing to install again. A training step is quoted before it starts and held to a hard spend cap.

## How it works

### Build the task environment once, and let a test prove it

A recipe build clones your task repository at a pinned commit, runs the setup, then runs your verify command. Only a build whose verify command exits 0 is stored. One that fails its own check is billed for the time it ran, and the copies started from a stored snapshot pay no further build charge. Pin the commit, since a moving ref gives a different environment next week.

```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
```

### Quote the training step, then cap it

Before a step starts, `promigence run quote` gives its ceiling: the cost if every rollout used its full timeout. Set `--cap` at or below that number, and a step that would go over is refused before anything starts. From Python, `client.runs.quote` and `spend_cap` do the same job, as in the training-step code above. The quickstart walks through the quote and the cap from the CLI.

### Grade in a clean copy, and keep a held-out test

On `promigence run`, `--grade` scores the work in a clean copy of the environment after the rollout command ends, and `--holdout` runs a second, held-out test whose pass rate the report sets beside the first. A gap that widens over training deserves a look. `--verify-each` re-runs the snapshot's verify command in each sandbox before the rollout begins. Every flag is in the CLI reference.

### Branch a group of rollouts from one state

When several rollouts should start from the same mid-task point, take a snapshot of a running sandbox and fork the group from it. This tested program forks ten copies under one $3 cap, runs one attempt in each and keeps the first that passed. Put your rollout where `node agent.js` stands.

```python
from concurrent.futures import ThreadPoolExecutor
from typing import List

from promigence import Promigence, Sandbox

REPO = "https://github.com/your-org/your-app"

with Promigence() as client:  # reads PROMIGENCE_API_KEY
    setup = Sandbox.create(client=client, spend_cap=1, timeout_ms=30 * 60_000)
    setup.commands.run(f"git clone --depth 1 {REPO} /work/app && cd /work/app && npm install", timeout_ms=15 * 60_000)
    snap = client.sandboxes.snapshot(setup.sandbox_id, alias="app-installed", move_alias=True)
    setup.kill()

    copies: List[Sandbox] = Sandbox.fork(
        snap["snapshot_id"], client=client, count=10, spend_cap=3, timeout_ms=20 * 60_000,
    )

    def attempt(i: int) -> bool:
        result = copies[i].commands.run(
            "cd /work/app && node agent.js && npm test",
            envs={"ATTEMPT": str(i)}, timeout_ms=15 * 60_000, throw_on_exit=False,
        )
        return result.exit_code == 0

    with ThreadPoolExecutor(max_workers=10) as pool:
        passed = list(pool.map(attempt, range(10)))

    winner = passed.index(True) if True in passed else None
    print(f"attempt {winner} passed" if winner is not None else "no attempt passed")
    for i, sbx in enumerate(copies):
        if i != winner:
            sbx.kill()
```

## What you get, in numbers

| What | Result | Conditions |
|---|---|---|
| RL rollouts per minute, 8 at once | 1,343 | n=40, p50 [Source](https://www.promigence.ai/#numbers) |
| 100 sandboxes started together, slowest 5% | 0.94 s | p95, n=400, every run completed [Source](https://www.promigence.ai/#numbers) |
| wake a paused sandbox | 104 ms | p50 over n=100, resume to first database query; under load, 127 ms [Source](https://www.promigence.ai/#numbers) |
| sandboxes at once on Max | 1,000 | at the $500 level; 500 at $250; Enterprise sets its own limit [Source](https://www.promigence.ai/#pricing) |

## What it costs

A training run of 50 steps, each step 400 rollouts on small sandboxes (2 vCPU, 4 GiB) with a 5-minute timeout, on the Max plan, which runs up to 500 at once. The step count, the width, the timeout and the average rollout length are all example inputs.

Quote per step: 400 × 300 s × $0.000046 per second = $5.52, so 50 steps quote at 50 × $5.52 = $276.00. The environment's snapshot is built once, for at most $0.17 at small, and every step reuses it. If rollouts average 2 minutes, a step bills 400 × 120 s × $0.000046 = $2.21 and the run about $110.40.

Total: at most $276.17 for the whole run with the build, about $110.57 at a 2-minute average.

A step's quote is a ceiling that `--cap` (or `spend_cap` in the SDK) enforces, so one runaway step cannot spend the run's budget. Paused time is not billed: a rollout on opt-in auto-pause accrues nothing while it waits on the policy, and wakes on the next request. For sustained volume, Enterprise sets committed-use rates on one call.

## Security and limits

- Rollouts cannot contaminate each other: a sandbox has no way to see or reach any other, and one rollout's writes stay in its own sandbox.
- Network access is set per run: none at all, open, or limited to a list of hosts, and every refused connection is recorded.
- A key you hand to one rollout stays out of the environment the others start from: secrets arrive at run time, and no snapshot stores a secret unless you force it.
- Trajectories are yours: customer code, files, prompts and agent outputs do not go into training any AI model.

## Related

- [Snapshot a running sandbox, then fork 10 copies](https://www.promigence.ai/docs/guides/snapshot-and-fork)
- [Quickstart: price a run, cap it, read the report](https://www.promigence.ai/docs/quickstart)
- [CLI reference: run flags, graders included](https://www.promigence.ai/docs/cli)
- [What an episode is](https://www.promigence.ai/glossary/episode)
- [Plans and limits, with per-second rates](https://www.promigence.ai/#pricing)
- [Free validity report on your environments](https://www.promigence.ai/validity-report)

## Questions

### How do environment failures stay out of the reward?

Drop the episodes the report classes as environment failures before you compute the reward. Every run splits them from task failures, sandbox by sandbox, and `promigence run replay` sends only the environment failures through again, in new sandboxes, counted on their own.

### Can thousands of rollouts run without sharing state?

Yes. Each rollout gets its own sandbox started from the same verified snapshot, and nothing one rollout writes reaches another. A 1,000-wide step fits the $500 level of Max.

### Which trainers and model providers does it work with?

Any trainer that can call the Python or TypeScript SDK, the REST API or a shell command can drive it. It is model-neutral and lab-neutral and runs any vendor's agent, which a cross-lab comparison needs.

### What helps against reward hacking?

Grade where the agent never worked, and keep a test it never saw. `--grade` scores the work in a clean copy after the rollout ends, `--holdout` adds a held-out test with the gap shown in the report, and `promigence sandbox probe` checks whether a sandbox's files still match the verified snapshot it started from.

### Do idle rollouts cost money while the policy is thinking?

An idle rollout costs nothing while it is paused. Auto-pause on idle is opt-in (`promigence sandbox autopause`), and the sandbox wakes on the next request, measured at 104 ms p50 from resume to a first database query. A paused sandbox is kept for 30 days.

### Will a rollout be killed for pinning every CPU?

No. Health checks cannot be starved by your workload, so a busy environment is never marked unhealthy, even with every vCPU busy.

### Is there volume pricing for millions of episodes?

Yes, on the Enterprise plan, priced on one call with committed capacity contracts and reserved capacity. Max already includes 5× the usage of Pro, with usage past that billed below list by commitment.

### Can it be deployed in our own cloud account?

Deployment in your own cloud account is an Enterprise conversation. The Enterprise plan lists it as something to settle on the call, for training data that has to stay inside your boundary.

