---
title: Run agent evaluations in isolated sandboxes
description: Run each trial of an agent evaluation in its own Vercel Sandbox, forked from one baseline, and compare repeatable results.
url: "https://vercel.com/kb/prompts/run-agent-evals-in-sandboxes"
last_updated: 2026-12-01
related_resources:
  "[Run research agents, data analysis, and evals on Vercel Sandbox](/kb/guide/sandbox-research-workloads)": "Give a research agent a Python execution tool, analyze datasets, fork parallel trials from one baseline, restrict network access, and resume a workspace across sessions."
  "[Agents are users, so your software needs evals](https://vercel.com/blog/agent-evals)": "Build end-to-end agent evals and choose between pass@k and pass^k when results vary between runs."
  "[Snapshot and restore a sandbox](https://vercel.com/docs/sandbox/examples/snapshot-and-restore)": "Snapshot a prepared Vercel Sandbox or fork it so new sandboxes start from the same filesystem state."
  "[Design task-specific evaluations](https://developers.openai.com/api/docs/guides/evaluation-best-practices)": "Define evaluation objectives, datasets, metrics, and human review before comparing changes."
---

# Run agent evaluations in isolated sandboxes

Run each trial of an agent evaluation in its own Vercel Sandbox, forked from one baseline, and compare repeatable results.

Evaluate an agent that edits files or runs commands without one trial's changes leaking into the next. This prompt builds a harness that prepares a baseline environment once, then runs every trial in a fresh Vercel Sandbox started from it.

Open or import the agent project and describe the tasks to evaluate and how a run passes or fails. Provide approved synthetic tasks or redacted cases separately. The handoff carries prompt text, without your repository, credentials, or evaluation data.

Expect a task set, a harness that records each trial, and a report that shows per-task results next to the totals. Dry runs check the harness itself; agent quality still needs an approved live run and human review of the failures.

## Agent prompt

```text
Build a repeatable evaluation harness for the agent in this project that runs every trial in its own Vercel Sandbox, started from the same prepared baseline.

If the project is unavailable, ask me to open or import it first. Read repository instructions and inspect the agent's entry point, framework and SDK versions, tools, model configuration, and test runner. Reuse the existing stack. Install the Vercel Sandbox SDK for the project's language if it is missing, and verify the installed version's snapshot, fork, and command APIs before implementation. Ask which tasks matter, how each one is graded, and what counts as an unacceptable failure if that is unclear.

Create a small versioned task set from synthetic or explicitly approved redacted examples. Each task needs a starting state, an instruction for the agent, and a grader that checks the outcome inside the sandbox, such as running tests or inspecting files, rather than trusting the agent's own report. Include tasks the agent should refuse or stop on, and tasks where the instructions in the environment try to redirect it. Keep held-out tasks separate from the ones used while tuning.

Prepare the baseline once. Install dependencies and set up the starting state in one sandbox, then snapshot it or keep it as a named source sandbox. Start each trial from that baseline, by forking the source or creating a sandbox from the snapshot, so every trial begins identical and no state carries over. Make trials non-persistent, and set an explicit timeout for each one within the plan's runtime limit.

Lock down every trial sandbox. The default network policy allows all outbound traffic, so set `deny-all`, or an allow list of the exact domains the task needs, such as a package registry or the model provider. Keep provider keys and Vercel credentials on the harness side; if the agent needs to call a model from inside the sandbox, use credential brokering or a proxy rather than writing secrets into the sandbox. Stub tools that would change real systems.

Run trials with bounded concurrency that stays within the team's concurrent sandbox quota. Record the agent version, model identifier and settings, task set version, baseline snapshot, each trial's commands, exit codes, grader output, duration, and errors. Stop every sandbox when its trial ends, including after a timeout or a crash, and count failed or timed-out trials as failures rather than dropping them.

Run each task more than once where results vary. Report the share of tasks that passed at least once and the share that passed on every attempt, because those answer different questions. Show per-task results, failures, and sample sizes next to any aggregate score, and keep the logs of failed trials for review.

First dry-run the harness with a scripted stand-in for the agent, including one trial that passes, one that fails grading, one that times out, and one that tries a blocked network request. Dry runs show the harness works, not that the agent is good. Ask before creating real sandboxes at scale, making paid model calls, or sending data externally. Do not deploy or change the production agent.

Report what ran, actual results, local commands, required configuration, and the live evaluation still needed. Explain uncertainty rather than declaring a winner from a small or noisy run.
```

## Related resources

- [Run research agents, data analysis, and evals on Vercel Sandbox](/kb/guide/sandbox-research-workloads): Give a research agent a Python execution tool, analyze datasets, fork parallel trials from one baseline, restrict network access, and resume a workspace across sessions.

- [Agents are users, so your software needs evals](https://vercel.com/blog/agent-evals): Build end-to-end agent evals and choose between pass@k and pass^k when results vary between runs.

- [Snapshot and restore a sandbox](https://vercel.com/docs/sandbox/examples/snapshot-and-restore): Snapshot a prepared Vercel Sandbox or fork it so new sandboxes start from the same filesystem state.

- [Design task-specific evaluations](https://developers.openai.com/api/docs/guides/evaluation-best-practices): Define evaluation objectives, datasets, metrics, and human review before comparing changes.

## Try other prompts

- [Evaluate an agent before changing its prompt](/kb/prompts/evaluate-agent-prompt-changes): Build a repeatable evaluation for an AI SDK agent, compare prompt versions, and surface failures hidden by an average score.

- [Add a code execution tool to your agent](/kb/prompts/add-sandbox-code-execution-tool): Give your agent a tool that runs generated code in Vercel Sandbox, with network limits, timeouts, and bounded results.

## Reference Architecture

Choose a stack and work through the decisions behind it, with curated documentation, guides, templates, and courses to help you build.

- [Agent stack](/kb/architecture/agents): Build and operate agents with models, tools, and durable workflows.
- [Web applications](/kb/architecture/web): Choose rendering, data, authentication, and caching approaches.
- [Backends](/kb/architecture/backends): Choose a runtime, connect services, and run background work.

[Browse all stacks](/kb/architecture)

## Build with prompts

Build an app, extend an agent, or improve your project with ready-to-use prompts for your coding agent.

[Browse the prompt library](/kb/prompts) · [Read the Markdown index](/kb/prompts.md)
