The sandbox is the agent’s isolated bash environment: a filesystem rooted atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vercel/eve/llms.txt
Use this file to discover all available pages before exploring further.
/workspace where the agent can run shell commands, execute scripts, and read or write files without ever touching your app runtime. Every eve agent has exactly one. The built-in bash, read_file, write_file, glob, and grep tools already target it, and your authored tools can reach it too via ctx.getSandbox().
A working sandbox exists by default — nothing to author. Override it only to add setup, seed workspace files, pick a specific backend, or lock down network egress.
Built-in sandbox tools
The model already has shell and file access through the default harness tools:| Tool | Does |
|---|---|
bash | Run a shell command in the sandbox |
read_file / write_file | Read/write files under /workspace |
glob | Find files by pattern |
grep | Search file contents |
/workspace as the working directory.
Accessing the sandbox from tools
Any authored runtime function — a tool, a step, a model callback — can get a live sandbox handle withctx.getSandbox(). It is async and only works inside authored runtime execution:
agent/tools/run_analysis.ts
/workspace is one namespace across every backend — /workspace/foo points at the same file whether the backend is local or Vercel. To interpolate a path into a generated command, sandbox.resolvePath("repo/build.py") anchors a relative path to its absolute /workspace/repo/build.py form.
Sandbox handle methods
All methods accept relative paths (resolved from/workspace) or absolute paths (passed through untouched):
| Method | Does |
|---|---|
run({ command }) | Run one command, block until it exits, return { stdout, stderr, ... } |
spawn(options) | Launch a long-running process (server, watcher) and return a SandboxProcess handle |
readTextFile / writeTextFile | Read/write a UTF-8 file; readTextFile supports 1-based line ranges |
readBinaryFile / writeBinaryFile | Read/write raw bytes (images, archives, anything non-text) |
readFile / writeFile | Stream a file in/out as bytes |
removePath({ path, force, recursive }) | Delete one file or directory; force ignores missing paths, recursive removes non-empty dirs |
resolvePath(path) | Anchor a relative path to its absolute /workspace/... form |
setNetworkPolicy(policy) | Change egress policy mid-turn (backend-dependent) |
run blocks until the command exits, use spawn when the process should keep running while the agent does other work:
agent/tools/dev_server.ts
SandboxProcess exposes stdout/stderr byte streams, wait() (resolves with the exit code), and kill() (idempotent).
sandbox.id is a stable per-session identifier that persists across reconnects to the same logical session.
Seeding /workspace
Mount authored files into the sandbox at session start by placing them underagent/sandbox/workspace/. This requires the folder layout (not the top-level agent/sandbox.ts shorthand):
workspace/ mirrors into the sandbox with its directory structure intact. eve lists the top-level entries to the model in the prompt automatically.
Overriding the sandbox with defineSandbox
To add setup, seed files, or pick a backend, authordefineSandbox from eve/sandbox. Two layouts are supported:
agent/sandbox.ts— shorthand; use it when you need only a definition with no seeded files.agent/sandbox/sandbox.ts— folder layout; use it when you also seedagent/sandbox/workspace/**. If both exist, the folder layout wins.
agent/sandbox/sandbox.ts
Sandbox lifecycle
bootstrap
Template-scoped, runs once when the template is built. Put reusable setup here that every later session inherits: cloning a baseline repo, installing dependencies, or seeding files. Call
use() to get a SandboxSession. Set revalidationKey: () => string when external inputs affect what bootstrap produces so eve knows when to rebuild.agent/sandbox/sandbox.ts
If you require a network policy for every session, configure it on the backend factory or in
onSession. Do not rely on bootstrap-only configuration.Backends
eve ships four pinned backend factories plus an availability-aware default:| Backend | Runs the sandbox |
|---|---|
vercel() | On Vercel Sandbox |
docker() | Locally in a Docker container, driven through the docker CLI |
microsandbox() | Locally in a lightweight microsandbox VM |
justbash() | Locally in the pure-JS just-bash interpreter (no daemon or VM, but no real binaries) |
defaultBackend() | Picks the best available: Vercel Sandbox → Docker → microsandbox → just-bash |
backend omitted, eve uses defaultBackend(). You can configure each inner backend:
agent/sandbox/sandbox.ts
Network policy
Egress rules go on the backend factory or inonSession’s use():
bootstrap code runs. Set it in onSession’s use() to override per-session. Call sandbox.setNetworkPolicy(...) on the live handle to change the policy mid-turn.
Subagent sandboxes
Each declared subagent gets its own sandbox, independent of its parent. The built-inagent tool (a copy of the same agent) is the exception — its children share the parent’s sandbox because they are copies working on the same files.
The default sandbox is not a substitute for configuring network policy, credentials, retention, deletion, or other controls your application requires.