Evals and RL environments
Run many episodes of an agent in clean sandboxes, from one saved environment, without running any twice
An eval or a reinforcement-learning run starts the same environment many times, lets an agent act in each copy, and scores what it left behind. Pod fits that shape: an environment is a snapshot, an episode is a sandbox, and a create that is sent twice still makes one sandbox.
One snapshot for each version of the environment
Build the environment once in a sandbox: install the tools, check out the task's code, warm what needs warming. Then take a snapshot and name it after the version, such as swe-env-v12. Every episode starts from that snapshot, so every episode starts from the same bytes.
When the environment changes, make a new snapshot with a new name and keep the old one for as long as you may need to re-run old results.
One sandbox for each episode
Start each episode from the snapshot, with labels that say which run and which episode it is, a time limit, and an Idempotency-Key made from the run and the episode:
async function episode(run: string, n: number) {
const sandbox = await pod.sandboxes.create(
{
snapshot: ENV_SNAPSHOT_ID,
labels: { run, episode: String(n) },
time_limit_s: 1800,
},
{ idempotencyKey: `${run}-episode-${n}` }
);
try {
await sandbox.run(["/opt/env/agent", "--task", TASK], { timeout_s: 1500 });
const score = await sandbox.run(["/opt/env/score"]);
return Number(score.stdout.trim());
} finally {
await sandbox.delete();
}
}def episode(run: str, n: int) -> float:
sandbox = pod.sandboxes.create(
snapshot=ENV_SNAPSHOT_ID,
labels={"run": run, "episode": str(n)},
time_limit_s=1800,
idempotency_key=f"{run}-episode-{n}",
)
try:
sandbox.run(["/opt/env/agent", "--task", TASK], timeout_s=1500)
score = sandbox.run(["/opt/env/score"])
return float(score.stdout.strip())
finally:
sandbox.delete()- Idempotent creates. If your runner crashes and starts again, the same key answers the sandbox it already made instead of a second one, for 24 hours.
- A time limit stops an episode that hangs, so a stuck agent costs no more than the limit.
- Labels let you list a run's sandboxes with
label=run=…, find what is still running, and read the run's usage. - Delete each sandbox when its score is read. A sandbox you keep for a closer look sleeps after its idle time and costs only its disk while it sleeps.
Many episodes from a warm state
If every episode needs a long warm-up, run it once and fork the warm sandbox: up to 10 running copies at once, each with its own disk from that moment on.
Episodes with a screen
Not available yet Seeing and acting on a sandbox's screen is not offered yet. Commands, files and ports work today.
For computer-use agents, an episode's observation is a screenshot and its action a click or a keystroke. See Desktop apps.
Limits
How many sandboxes you may hold and keep awake at once is set for your organization and each project (Limits). A create past a limit answers quota_exceeded: queue your episodes so that no more run at once than your limit allows.