If you build a coding agent, you need to know whether this week's prompt change made it better or worse. The only honest way to know is to run it on a fixed set of tasks and check the results. That is an eval, and running one well is mostly an infrastructure problem: every attempt needs the same starting state, attempts must not affect each other, and the agent must not be able to see or edit the tests that grade it.

This post describes an eval harness built on sandboxes. Each attempt runs in its own Firecracker microVM, started from a snapshot, and is thrown away afterwards. It uses the Sandscale TypeScript SDK, snapshots and the API limits docs.

What has to be true

  • Same start, every time. Every attempt begins from byte-for-byte the same repository and installed dependencies. Otherwise a pass or fail might be about the environment, not the agent.
  • No cross-talk. Attempt 14 must not see files attempt 13 left behind, and a runaway attempt must not slow its neighbours to the point of timing out.
  • Tests the agent cannot touch. If the grading tests are in the box while the agent works, a capable agent may read them, special-case them, or edit them. That inflates scores in ways that look like progress.
  • Repeatable bookkeeping. For each attempt you want the task id, the model and prompt version, the result and what it cost.

Build the starting state once

Start a sandbox from a template, put the repository in, install dependencies, and snapshot it:

  1. sandboxes.create({ template: 'builtin:node' })
  2. upload the project (the API takes a gzip tar archive for a whole folder; see uploading a project),
  3. sandboxes.run(id, 'npm ci'),
  4. remove the grading tests from the tree,
  5. sandboxes.snapshot(id, { label: 'eval-base-2026-11' }),
  6. stop the box.

The snapshots guide says a snapshot is an archive of the sandbox's /workspace, checked end to end, and that a sandbox started from it with create({ snapshotId }) gets the snapshot's files. If the archive fails its check, the start fails rather than giving you a broken workspace, which is the behaviour an eval wants: a failed start is an infrastructure error, not a task failure.

Note what a snapshot does not include. It is the /workspace directory, and nothing mounted into the workspace is included. Anything the agent needs outside /workspace must come from the template.

One box per attempt

import { Sandscale } from '@sandscale/sdk'; const sandscale = new Sandscale(); interface EvalTask { id: string; prompt: string; testCommand: string } interface EvalResult { taskId: string; passed: boolean; exitCode?: number; error?: string } // Run every task against the same starting state, a few at a time. export async function runEval( tasks: EvalTask[], baseSnapshotId: string, runAgent: (sandboxId: string, region: string | undefined, prompt: string) => Promise<void>, concurrency = 3, ): Promise<EvalResult[]> { const results: EvalResult[] = []; const queue = [...tasks]; const evalId = `eval-${Date.now()}`; async function worker() { for (let task = queue.shift(); task; task = queue.shift()) { const box = await sandscale.sandboxes.create({ snapshotId: baseSnapshotId, timeoutSeconds: 1800, labels: { eval: evalId, task: task.id }, }); try { await runAgent(box.id, box.region, task.prompt); const check = await sandscale.sandboxes.run(box.id, ['sh', '-c', task.testCommand], { region: box.region, timeoutSeconds: 600, }); results.push({ taskId: task.id, passed: check.exitCode === 0, exitCode: check.exitCode }); } catch (err) { results.push({ taskId: task.id, passed: false, error: String(err) }); } finally { await sandscale.sandboxes.stop(box.id, { region: box.region }); } } } await Promise.all(Array.from({ length: concurrency }, worker)); return results; } 

Each attempt gets its own box from the same snapshot, the agent works in it through whatever tools you give it, and the box is stopped in finally whether the attempt passed, failed or threw. timeoutSeconds on create bounds a stuck attempt even if your harness dies.

Copy the tests in after the agent is done

The sketch above runs testCommand in the box the agent used. For a real eval, add one step between the agent finishing and the check: write the hidden tests into the box with sandboxes.writeFile, or upload them as an archive, and only then run them. The agent never had them.

Two more guards worth adding:

  • Restore the test harness files too. If grading uses a config file such as jest.config.js or pytest.ini that the agent could have edited, overwrite it with your copy before running tests.
  • Diff before grading. Capture git diff from the box and store it with the result. When a score jumps, the diff is the first thing you will want to read.

Concurrency within your plan

Your plan sets how many boxes can run at once: 3 on Free, 30 on Pro and Team, more on request or by agreement. The worker pool in the sketch takes a concurrency argument; keep it under that number, leaving room for anything else your organization runs.

If you go over, the API refuses the create before anything starts, with quota_exceeded, and rate-limited calls get 429 with a Retry-After header. The API limits page gives the retry rules: retry 429 after Retry-After, retry 502, 503 and 504 with exponential backoff and jitter, and do not retry 4xx errors unchanged. It also warns that a POST that creates something is not always safe to repeat after a timeout: list what exists before creating again. For an eval, the labels make that easy, since sandboxes.list with the eval and task labels shows whether an attempt's box already exists.

Treat infrastructure failures separately from task failures in your results. A box that could not start is not evidence the agent got worse.

Labels and cost

Each box carries eval and task labels. Add the model and prompt version too. Those labels are what tie your result rows to the sandboxes and their audit entries later.

For cost, the plans reference says hours are awake vCPU-hours and a box counts only while it is awake. An eval's compute is roughly the number of attempts times their size times how long each stays awake. Keeping boxes small (see sizing sandboxes) and stopping each one the moment it is graded keeps that predictable. On paid plans, spend caps per project are a sensible guard for a job that can fan out.

Repeat attempts

Agents are not deterministic, so one attempt per task tells you less than you think. Run each task several times and report the pass rate per task, not just an overall score. With one box per attempt and a shared snapshot, repeats cost compute but no extra engineering. Reproducible agent runs covers what to record so a surprising result can be replayed.

Network during evals

Default to no network. The SDK's network option is none unless you ask for allowlist. An eval task that needs the internet will produce results that depend on the internet, which is the opposite of what you want from a benchmark. If some tasks genuinely need a package registry, use your organization's allowlist for those tasks only and record that they did.

Originally published on the Sandscale blog.