---
title: Vercel Sandbox vs Fly.io Sprites
description: Compare Vercel Sandbox and Fly.io Sprites as AI agent sandboxes, including isolation, persistence, network controls, SDKs, and idle behavior.
keywords: ["Vercel Sandbox","Fly.io Sprites","AI agent sandbox","untrusted code execution","Firecracker microVM"]
url: "https://vercel.com/kb/guide/vercel-sandbox-vs-fly-io-sprites"
published: 2026-11-25
last_updated: 2026-11-25
authors: Ben Sabic
install_vercel_plugin: npx plugins add vercel/vercel-plugin
search_with_vercel_cli: npx vercel@latest kb search "<query>"
read_with_vercel_cli: "npx vercel@latest kb inspect vercel-sandbox-vs-fly-io-sprites"
---

[Vercel Sandbox](https://vercel.com/docs/sandbox) and [Fly.io Sprites](https://fly.io/sprites/) run generated code in Firecracker microVMs. Both AI sandboxes preserve files by default. Vercel snapshots files on stop; Sprites pause when idle and wake on commands or HTTP requests.

Choose Vercel Sandbox for per-sandbox resource settings, regional controls, custom starting images, or request-level credential injection. Choose Sprites for HTTP-triggered wake, private URLs by default, and processes that resume after a warm pause. After a cold wake, registered Services restart automatically; other processes need to be started again.

## How Vercel Sandbox and Fly.io Sprites compare

### Compute and resources

Both products give each environment its own [Firecracker microVM and kernel](https://vercel.com/docs/sandbox/concepts/security). Fly.io runs [user code in an inner container](https://fly.io/blog/design-and-implementation/) within that VM and provides root access. Compare lifecycle, resource controls, and network access to decide which environment fits your workload.

| **Concern**             | **Vercel Sandbox**                                                                              | **Fly.io Sprites**                                                                                                                                                                                     |
| ----------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Isolation               | Firecracker microVM with its own kernel                                                         | Firecracker microVM with its own kernel and filesystem                                                                                                                                                 |
| Base environment        | [Ubuntu or Arch images](https://vercel.com/docs/sandbox/concepts/images), or a custom OCI image | New Sprites run [Ubuntu 26.04](https://docs.fly.io/sprites/sprite-maintenance) with language runtimes and coding agent CLIs preinstalled. The create request and `sprite create` take no image option. |
| vCPUs                   | 1 vCPU or an even number; default 2. Maximums: 4 (Hobby), 8 (Pro), 32 (Enterprise).             | [8 vCPUs](https://docs.fly.io/sprites/concepts/lifecycle) for every Sprite. You don't set or resize the count.                                                                                         |
| Memory                  | 2 GB per vCPU. Limits: Hobby 8 GB, Pro 16 GB, Enterprise 64 GB.                                 | Platform-managed memory, with a limit and autoscaling setting available through the [resources policy](https://docs.fly.io/sprites/api/network-policy/set-resources-policy).                           |
| Disk                    | 64 GB of ephemeral NVMe with SDK 3.0.0+ or a custom image                                       | 100 GB of persistent ext4 storage for every Sprite, thin-provisioned. It doesn't autoscale.                                                                                                            |
| Concurrent environments | Hobby: 10. Pro and Enterprise: 10,000.                                                          | Limits apply to each organization and [scale with the plan](https://fly.io/sprites/). The Free plan allows up to 3 Sprites.                                                                            |
| SDKs and tools          | TypeScript SDK, sync/async Python SDK, Sandbox CLI, Vercel CLI, and Vercel REST API             | `sprite` CLI, REST API, and SDKs for JavaScript, Python, Go, and Elixir                                                                                                                                |
| Authentication          | Project-scoped Vercel OIDC token, or an access token with team and project IDs                  | Fly.io account. An [API token](https://docs.fly.io/sprites/cli/authentication) that belongs to an organization, sent as a bearer token.                                                                |
| Plan                    | Hobby, Pro, and Enterprise                                                                      | Free, which requires a credit card, and Pay As You Go [account plans](https://fly.io/pricing/)                                                                                                         |

Vercel's default universal image includes Node.js 24 and Python 3.14 on Ubuntu 26.04. Sprites include [language runtimes](https://docs.fly.io/sprites/working-with-sprites) such as Node.js, Python, Go, and Rust, along with coding agent CLIs.

### Lifecycle

Vercel saves a persistent sandbox's files when its time-limited session stops. Sprites preserve their filesystem through [idle pauses](https://docs.fly.io/sprites/concepts/lifecycle), which begin after about 30 seconds without activity. Commands and HTTP requests wake them again.

| **Concern**           | **Vercel Sandbox**                                                                                                                          | **Fly.io Sprites**                                                                                                                                                                                      |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Session end           | Default 5 minutes. Extend to 45 minutes on Hobby or 24 hours on Pro and Enterprise with `sandbox.extendTimeout()`.                          | Pauses about 30 seconds after activity stops. Fly.io describes Sprites as having no time limits.                                                                                                        |
| What keeps it running | The session timeout, which your code can extend                                                                                             | An in-flight HTTP or API request, output to a session or executed process's stdout, an open TCP connection to the Sprite URL, or an active task                                                         |
| State kept by default | [Filesystem and configuration snapshotted on stop](https://vercel.com/docs/sandbox/concepts/persistent-sandboxes)                           | The filesystem, which syncs continuously to object storage. Warm Sprites also keep their memory.                                                                                                        |
| Running processes     | Not restored on resume                                                                                                                      | Resume after a warm pause. Dropped on a cold wake, after which [Services](https://docs.fly.io/sprites/concepts/services) start again.                                                                   |
| How it resumes        | An SDK operation that requires a running VM, such as `runCommand()`, starts a new session from the latest snapshot                          | Running a command or sending an HTTP request to the Sprite URL wakes it                                                                                                                                 |
| Snapshots             | Automatic on stop, or manual with `snapshot()`. They expire 30 days after last use by default, and you can change or remove the expiration. | [Checkpoints](https://docs.fly.io/sprites/concepts/checkpoints) of the writable filesystem, manual with `sprite checkpoint create` or automatic. The last five are mounted read-only inside the Sprite. |
| Disposable mode       | `persistent: false` discards the filesystem when the session stops                                                                          | Destroy the Sprite, which permanently deletes its files and checkpoints                                                                                                                                 |

Redirecting output to a file or detaching tmux doesn't reset a Sprite's idle timer. To keep a Sprite active through background work, register a task with the [Tasks API](https://docs.fly.io/sprites/keeping-sprites-running). Each task lasts at most an hour, so longer runs refresh it on a heartbeat.

On Vercel, each resume starts a new session timeout. The same persistent sandbox can span repeated sessions while its saved snapshot remains available. Requests to a stopped sandbox's public URL return [HTTP 410](https://vercel.com/docs/errors/sandbox_stopped). Resume the sandbox and restart its server with `runCommand()` before sending traffic.

### Networking and security

Both products allow outbound internet access by default and support policies that restrict it. Vercel Sandbox uses a declarative firewall with domain and CIDR rules. Sprites use an opt-in, DNS-based allowlist that you apply from outside the Sprite through the Sprites API.

| **Concern**          | **Vercel Sandbox**                                                                                                                 | **Fly.io Sprites**                                                                                                                                                                                                                                                                              |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Default egress       | Allow all                                                                                                                          | Unrestricted                                                                                                                                                                                                                                                                                    |
| Egress controls      | Allow all, deny all, or [domain/CIDR allow lists](https://vercel.com/docs/sandbox/concepts/firewall); denied CIDRs take precedence | [Network policy](https://docs.fly.io/sprites/concepts/networking) with allow and deny rules for exact hosts, subdomain wildcards, or all domains. With a policy in force, raw IP connections are blocked unless the IP was resolved from an allowed domain, and private IPs are always blocked. |
| Runtime updates      | Replace the policy without restarting the session                                                                                  | Changes apply live, and connections to newly blocked domains are dropped. The policy is read-only inside the Sprite.                                                                                                                                                                            |
| Credential injection | Brokering rules on allowed domains that match path, method, query parameters, and headers                                          | [Connectors](https://docs.fly.io/sprites/concepts/connectors). Code calls a gateway URL, and the gateway attaches the stored credential and forwards the request to the provider.                                                                                                               |
| Inbound access       | Up to 15 ports, each with a public URL that anyone with the URL can reach                                                          | The Sprite URL routes HTTPS to port 8080 by default and requires authentication unless made public. `sprite proxy` forwards TCP ports to your machine.                                                                                                                                          |
| Compliance           | SOC 2 Type II certified infrastructure; snapshots encrypted at rest                                                                | Fly.io says it is SOC 2 Type 2 audited. Confirm whether Sprites are included in the [applicable audit scope](https://fly.io/compliance/).                                                                                                                                                       |

Credentials stored in a sandbox's environment are visible to code running there. Both products can instead add secrets after requests leave the sandbox: Vercel uses brokering rules, while Sprites send requests to a Connector gateway that attaches the stored credential.

Code inside the sandbox can still make requests that those controls authorize. Restrict destinations and permissions to the task on either platform.

### Regions

Vercel Sandbox runs in [19 regions](https://vercel.com/docs/sandbox/concepts/regions). Select a region per sandbox or set a project default; otherwise, Vercel uses `iad1` in Washington, D.C. Pro and Enterprise teams can configure failover, but Pro trials are excluded.

Snapshots stay in their source region. Failover can load them across regions; snapshots captured in the new session stay in the failover region.

Confirm the available Sprites regions and placement controls with Fly.io before committing to a latency or residency requirement.

### Core SDK calls

Install and authenticate the SDK before running its example:

- [Vercel Sandbox](https://vercel.com/docs/sandbox/sdk/javascript) reads `VERCEL_OIDC_TOKEN` from the environment.
  
- Fly.io Sprites takes a token as the client's first argument. Install [`@fly/sprites`](https://fly.io/sprites/ecosystem), which requires Node.js 24 or later. Create a token in the Fly.io dashboard under **Sprites**, then **Tokens**, and export it as `SPRITES_TOKEN`.
  

> **Warning:**
>
> `sprite.delete()` permanently deletes the Sprite, its files, and its checkpoints. Give the sample a name that no existing Sprite in your organization uses.

Save the Vercel script as `sandbox.mjs` and the Sprites script as `sprite.mjs`. Each one runs a command, writes and reads a file, then cleans up.

**Vercel Sandbox**

```javascript
import { Sandbox } from '@vercel/sandbox';

const sandbox = await Sandbox.create();

try {
  const result = await sandbox.runCommand('node', ['--version']);
  if (result.exitCode !== 0) {
    const message = await result.stderr();
    throw new Error(message || 'Node version check failed');
  }
  console.log(await result.stdout());

  await sandbox.writeFiles([
    { path: 'hello.txt', content: Buffer.from('hi') },
  ]);
  const file = await sandbox.readFileToBuffer({ path: 'hello.txt' });
  console.log(file?.toString());
} finally {
  await sandbox.stop();
}
```

**Fly.io Sprites**

```javascript
import { SpritesClient } from '@fly/sprites';

const token = process.env.SPRITES_TOKEN;
if (!token) throw new Error('SPRITES_TOKEN is required');
const client = new SpritesClient(token);
const sprite = await client.createSprite('my-sprite');

try {
  const result = await sprite.execFile('node', ['--version']);
  console.log(result.stdout);

  const fs = sprite.filesystem('/home/sprite');
  await fs.writeFile('hello.txt', 'hi');
  console.log(await fs.readFile('hello.txt', 'utf8'));
} finally {
  await sprite.delete();
}
```

By default, `sandbox.stop()` ends the Vercel session and snapshots its files. The next `runCommand()` resumes the same sandbox from that snapshot.

`sprite.delete()` destroys the Sprite along with its files and checkpoints, and you can't undo it. To keep the files, leave out the delete and let the Sprite go idle, which pauses it with its filesystem kept. To discard files, create the Vercel sandbox with `persistent: false` or delete the Sprite.

### Python SDK calls

Vercel's `vercel-sandbox` requires Python 3.11 or later and supports sync and async APIs. Fly.io's `sprites-py` requires Python 3.9 or later and provides `SpritesClient` and `AsyncSpritesClient`. Its package metadata classifies it as beta.

The Vercel excerpt uses its asynchronous interface; the Sprites excerpt uses the synchronous client. Follow the [Vercel Python SDK reference](https://vercel.com/docs/sandbox/sdk/python) or Fly.io's [SDK setup steps](https://fly.io/sprites/ecosystem) to install and authenticate the client. The Vercel excerpt is `sandbox_example.py`, and the Sprites excerpt is `sprite_example.py`.

Use an unused Sprite name. Cleanup calls `sprite.destroy()`, which permanently deletes the Sprite, its files, and its checkpoints.

**Vercel Sandbox**

```python
import asyncio

from vercel import sandbox


async def main() -> None:
    box = await sandbox.create_sandbox()

    try:
        result = await box.run_command(
            "python",
            ["--version"],
            capture_output=True,
            check=True,
        )
        print(result.stdout.decode().strip())

        await box.fs.write_text("hello.txt", "hi")
        text = await box.fs.read_text("hello.txt")
        print(text)
    finally:
        await box.stop()


asyncio.run(main())
```

**Fly.io Sprites**

```python
import os

from sprites import SpritesClient

with SpritesClient(token=os.environ["SPRITES_TOKEN"]) as client:
    sprite = client.create_sprite("my-sprite")

    try:
        result = sprite.run(
            "python", "--version", capture_output=True, check=True
        )
        print(result.stdout.decode().strip())

        fs = sprite.filesystem("/home/sprite")
        (fs / "hello.txt").write_text("hi")
        print((fs / "hello.txt").read_text())
    finally:
        sprite.destroy()
```

To build a [code interpreter](https://vercel.com/i/code-interpreter) on either product, write the model's script to a file and run it, or pass it to `python -c`. On Vercel Sandbox, write the script with `box.fs.write_text()` and run it with `run_command()`. On Sprites, call `write_text()` on a filesystem path and run the script with `sprite.run()`.

## Where Vercel Sandbox goes deeper

### Choice of resources

Vercel lets you choose a vCPU count for each sandbox. [Enterprise limits](https://vercel.com/docs/sandbox/pricing) reach 32 vCPUs and 64 GB of memory for builds that need more than eight cores.

Each Sprite runs with 8 vCPUs and platform-managed memory. The resources policy exposes a memory limit and an autoscaling setting. Vercel Hobby has a lower CPU ceiling of 4 vCPUs.

### Drives

[Vercel Drives](https://vercel.com/docs/sandbox/concepts/drives) separate working files from the starting environment. Reuse up to four drives per sandbox for workspaces or dependency caches, with one writable mount per drive and read-only snapshots for concurrent readers.

Drives must match the sandbox's main region, but [failover](https://vercel.com/docs/sandbox/concepts/regions) can load them across regions. Each Sprite retains files on its own 100 GB disk until destroyed.

### Declarative egress firewall and credentials brokering

The [Vercel firewall](https://vercel.com/docs/sandbox/concepts/firewall) controls outbound access through modes and allow lists. Brokering rules inject credentials into requests that match a path, method, query, or header. Add a direct-response rule to block other requests to an allowed domain.

Policies can change while code runs, so an agent can begin with egress denied and receive access to selected APIs as its task progresses.

For private dependencies, [managed npm credentials](https://vercel.com/docs/sandbox/concepts/credentials) use your project's or team's registry configuration, including GitHub Packages and JFrog Artifactory. Set `credentials: { npm: true }` when creating the sandbox to authenticate downloads without placing tokens in its `.npmrc`.

Vercel first checks the project's `NPM_TOKEN` or `NPM_RC` in the authentication environment. OIDC requests use the token's environment; access-token requests use Development. Team Shared Environment Variables in Development, then Preview, provide a fallback. Allow the registry hosts in the network policy. These credentials support installation only.

The Sprites network policy is a DNS-based allowlist that decides which domains a Sprite can reach. Request-level rules belong to Connectors, where an access policy set through the Connectors API can allow or block provider paths. Code calls the Connector's gateway URL in place of the provider's hostname.

### Public port URLs

Vercel exposes up to 15 ports through public URLs. Set ports at creation or update them later, then use [`sandbox.domain(port)`](https://vercel.com/docs/sandbox/examples/expose-a-port) to reach each server. Anyone with a URL can access it, so expose only services you intend to share.

The Sprite URL routes HTTPS to port 8080 by default. [`sprite proxy`](https://docs.fly.io/sprites/concepts/networking) forwards TCP ports to your machine while the CLI runs.

### Private network access

Attach a sandbox to a [Secure Compute network](https://vercel.com/docs/sandbox/concepts/secure-compute) to reach private APIs or databases in your AWS VPC over VPC peering. Public internet traffic leaves through the network's static IPs, which you can allowlist at external services. Secure Compute is an [additional Enterprise purchase](https://vercel.com/docs/networking/secure-compute).

With a network policy in force, Sprites always block private IP ranges. Fly.io's Sprites docs don't document private networking between a Sprite and your own network.

### Custom images from Vercel Container Registry

Store dependencies and tools in a `linux/amd64` OCI image in [Vercel Container Registry](https://vercel.com/docs/sandbox/concepts/images). Sandboxes start from the image but don't run its `ENTRYPOINT` or `CMD`, so start processes with `runCommand()` after creation.

The Sprites [create API](https://docs.fly.io/sprites/api/sprites/create-a-sprite) and CLI provide no custom-image option. Install additional tools on the Sprite's persistent disk to keep them available after a pause.

### Separate users for collaborating agents

Create a [Linux user for each agent](https://vercel.com/docs/sandbox/concepts/multi-agent) to give agents separate home directories and file permissions within one sandbox. The JavaScript and Python SDKs support users, and the JavaScript SDK adds groups with shared directories. Your application keeps access to every agent's files. The users share one microVM, so run agents in separate sandboxes when each needs its own kernel.

On Sprites, [each agent needs a separate VM](https://fly.io/agents-need-a-computer) to have its own kernel.

### Agent framework integrations

eve includes a Vercel Sandbox provider in `eve/sandbox/vercel`. With that provider, sessions run code in Vercel Sandbox and can use supported [Vercel Drive mounts](https://vercel.com/kb/guide/vercel-drives-eve-agent). [Mastra](https://vercel.com/docs/sandbox/ecosystem/mastra) and [Flue](https://vercel.com/docs/sandbox/ecosystem/flue) also provide Vercel Sandbox integrations.

Explore [Vercel Sandbox integrations](https://vercel.com/docs/sandbox/ecosystem) for other frameworks.

### Coding agents in a coding sandbox

Coding agents can run inside Vercel Sandbox or offload work from your machine:

- Run the agent inside a sandbox. The [Sandbox CLI](https://vercel.com/docs/sandbox/sdk/cli) starts a supported agent, such as OpenCode, Claude Code, or Codex, in a sandbox, and you use its interface from your local terminal.
  
- Keep the agent local and offload heavy work. The agent edits on your machine and uses Vercel Sandbox as a remote coding sandbox. The [offload-to-sandbox](https://skills.sh/vercel/vercel-plugin/offload-to-sandbox) skill, included in the [Vercel plugin](https://vercel.com/docs/agent-resources/vercel-plugin), moves heavy builds, long test suites, and parallel tasks into their own sandboxes, then collects the results and cleans up.
  

Hosted coding agents can use Vercel Sandbox too. [Cursor Cloud Agents](https://vercel.com/docs/sandbox/ecosystem/cursor) run through Team Pools on Cursor Enterprise. [Devin Outposts](https://vercel.com/docs/sandbox/ecosystem/devin) require Outposts access and administrator permissions, plus a Vercel Pro or Enterprise team.

Sprites ship with coding agent CLIs in the base image, and Fly.io publishes plugins and a [hosted MCP server](#preinstalled-coding-agents-and-a-hosted-mcp-server) that let coding agents create and manage Sprites.

## Where Fly.io Sprites goes deeper

### Warm suspend and wake on request

An idle Sprite first enters a warm pause that [freezes memory and running processes](https://docs.fly.io/sprites/concepts/lifecycle). Those processes continue on a warm wake. After a longer idle period, the Sprite goes cold and loses its in-memory state. You cannot select or observe that transition, and TCP connections do not survive either pause.

Commands and HTTP requests wake the Sprite. Register a server as a [Service](https://docs.fly.io/sprites/concepts/services) so the runtime restarts it after a cold wake. If the Service is stopped when a request arrives for its HTTP port, the proxy starts it before forwarding the request.

Vercel Sandbox resumes from files without restoring processes; an [onResume hook](https://vercel.com/docs/sandbox/concepts/persistent-sandboxes) can restart them. HTTP requests cannot wake it.

### Persistent disk that syncs continuously

Each Sprite has a 100 GB ext4 filesystem backed by a local NVMe cache and durable object storage. Files sync continuously, so installed packages and on-disk databases survive a pause without an explicit stop operation.

Vercel saves files by snapshotting the sandbox's disk when its session stops.

### Private URLs by default

Sprite URLs are [private by default](https://docs.fly.io/sprites/concepts/networking). Access requires a Fly.io browser login or an organization token. The `private_access` setting restricts browser access to organization admins or allows all members.

To let anyone reach the Sprite URL without authenticating, run:

```bash
sprite config update --url-auth public
```

Vercel Sandbox port URLs are accessible to anyone who has the URL.

### Live checkpoints you can read inside the Sprite

Taking a [checkpoint](https://docs.fly.io/sprites/concepts/checkpoints) captures a Sprite's writable filesystem while the Sprite keeps running. Checkpoints are copy-on-write, so each one stores only the blocks that changed since the last. Sprites also checkpoint themselves in the background, and Fly.io prunes older automatic checkpoints over time.

The last five checkpoints are mounted read-only at `/.sprite/checkpoints/`, so an agent can read or diff an earlier state without restoring it. Code inside the Sprite can create, list, and restore checkpoints with the `sprite-env` CLI.

Restoring replaces the current filesystem without backing up the state it overwrites. It also restarts the environment and ends active sessions. Checkpoints contain files only, so processes started by hand must be restarted after a restore.

On Vercel, a manual [`snapshot()`](https://vercel.com/docs/sandbox/concepts/snapshots) stops the session after it captures the filesystem.

### Connectors for external services

[Connectors](https://docs.fly.io/sprites/concepts/connectors) store a provider credential once in your organization, encrypted, so the credential never enters a Sprite. Code calls a gateway URL with no `Authorization` header. The gateway identifies the calling Sprite, checks the connector's access policy, and forwards the request with the credential attached.

Connector access is denied until you grant it to matching Sprite names, labels, or all Sprites in the organization.

Use OAuth for providers such as GitHub, supply your own API key, or use Fly.io's managed OpenRouter connector without a separate OpenRouter account. The Custom API connector supports other token-authenticated HTTP APIs. Check which connectors are available to your organization.

### Preinstalled coding agents and a hosted MCP server

Every Sprite ships with Claude CLI, Gemini CLI, OpenAI Codex, and Cursor preinstalled, plus a `sprite-api-gateway` skill those agents use to call Connectors.

From outside a Sprite, Fly.io's [ecosystem page](https://fly.io/sprites/ecosystem) has plugin or MCP setup steps for Claude Code, Codex, Cursor, OpenCode, Pi, VS Code, and other agents. Fly.io also runs a hosted MCP server at `https://mcp.fly.io` with OAuth sign-in. Through it, an MCP client can create and manage Sprites, run commands, inspect checkpoints, and change network policy.

For background agents, register a Service for cold wakes and keep a task active while they work. The Sprite can pause after the task and other activity end.

## Estimate costs for your workload

Measure CPU use, memory, run time, retained storage, and transfer for a representative task. Apply the current rates and allowances from [Vercel Sandbox pricing](https://vercel.com/docs/sandbox/pricing) and [Fly.io pricing](https://fly.io/pricing/).

## Choose by workload requirements

Compare these AI agent sandboxes against your workload requirements:

| **Requirement**                                                   | **Product fit** | **Reason**                                                                      |
| ----------------------------------------------------------------- | --------------- | ------------------------------------------------------------------------------- |
| Credentials injected into requests to the provider's own hostname | Vercel Sandbox  | Firewall modes and brokering rules that match path, method, query, and headers  |
| Choose a specific Vercel deployment region                        | Vercel Sandbox  | 19 regions, chosen per sandbox or project                                       |
| Attach a sandbox to a Secure Compute network                      | Vercel Sandbox  | Enterprise network with AWS VPC peering and static egress IPs                   |
| More than 8 vCPUs in one environment                              | Vercel Sandbox  | Up to 32 vCPUs and 64 GB of memory on Enterprise; every Sprite has 8 vCPUs      |
| Custom OCI starting image                                         | Vercel Sandbox  | Images from Vercel Container Registry                                           |
| Working files mounted into later sandboxes                        | Vercel Sandbox  | Drives, up to four per sandbox, with read-only snapshots for concurrent readers |
| Processes that resume after a warm pause                          | Fly.io Sprites  | Warm pauses preserve memory; after a cold wake, Services restart processes      |
| HTTP-triggered wake                                               | Fly.io Sprites  | Requests to the Sprite URL wake an idle environment                             |
| Private URLs by default                                           | Fly.io Sprites  | Browser login or an organization token controls access                          |

For either AI agent sandbox, treat the [microVM boundary](https://vercel.com/i/what-is-firecracker) and the permissions granted to code as separate decisions. Match the session lifecycle to your workload, then restrict files, credentials, and network access to the task.

## Get started with Vercel Sandbox

Before you begin, make sure you have a [Vercel account](https://vercel.com/signup), the [Vercel CLI](https://vercel.com/docs/cli), and Node.js 22 or later. Sandbox is available on Hobby within the included usage.

Link this directory to the Vercel project that will own your sandboxes:

```bash
vercel link
```

Pull the project's environment variables into `.env.local`, including its development OIDC token. The token expires after 12 hours; repeat this command to refresh it.

```bash
vercel env pull
```

Install the SDK:

**pnpm**

```bash
pnpm i @vercel/sandbox
```

**npm**

```bash
npm i @vercel/sandbox
```

**yarn**

```bash
yarn add @vercel/sandbox
```

**bun**

```bash
bun add @vercel/sandbox
```

Save the Vercel sample from [Core SDK calls](#core-sdk-calls) as `sandbox.mjs` in the linked directory.

Each run creates a persistent sandbox and uses your plan's allowances or billing. For a disposable run without snapshot storage, pass `persistent: false` to `Sandbox.create()`.

Run the script with the environment file loaded:

```bash
node --env-file=.env.local sandbox.mjs
```

The script prints the sandbox's Node.js version and `hi`, then stops the session. With default persistence, its files remain in a saved snapshot.

### Start from an eve template

The [eve with Vercel Drives template](https://vercel.com/templates/eve/eve-vercel-drives-starter) connects an agent in Slack or a terminal to shared team files. Each session reads a Drive snapshot mounted at `/drive`.

The `save_to_drive` tool opens a separate, short-lived sandbox with a read-write Drive mount. The conversation's sandbox reads a snapshot of that Drive; its own workspace remains writable. Start a new session to pick up saved changes.

## Next steps

- Configure [session timeouts and persistent files](https://vercel.com/docs/sandbox/concepts/persistent-sandboxes)
  
- Restrict egress and broker credentials with the [Sandbox firewall](https://vercel.com/docs/sandbox/concepts/firewall)
  
- Expose a dev server with [public ports](https://vercel.com/docs/sandbox/examples/expose-a-port)
  
- Authenticate from outside Vercel with an [access token](https://vercel.com/docs/sandbox/concepts/authentication)
  
- Estimate your bill with [Sandbox pricing and quotas](https://vercel.com/docs/sandbox/pricing)
  
- Compare Vercel Sandbox with [Cloudflare Sandbox](https://vercel.com/kb/guide/vercel-sandbox-vs-cloudflare-sandbox), [CodeSandbox](https://vercel.com/kb/guide/vercel-sandbox-vs-codesandbox), [E2B](https://vercel.com/kb/guide/vercel-sandbox-vs-e2b), [Freestyle VMs](https://vercel.com/kb/guide/vercel-sandbox-vs-freestyle-vms), [Modal Sandboxes](https://vercel.com/kb/guide/vercel-sandbox-vs-modal-sandboxes), [Railway Sandboxes](https://vercel.com/kb/guide/vercel-sandbox-vs-railway-sandboxes), and [Upstash Box](https://vercel.com/kb/guide/vercel-sandbox-vs-upstash-box)
  
- Compare [AI sandbox providers](https://vercel.com/i/ai-sandbox-providers) by isolation, execution, and storage.
  
- Move apps and worker processes off Fly.io with the [Fly.io to Vercel migration guide](https://vercel.com/kb/guide/migrate-fly-io-to-vercel) and the [Fly.io workers to Vercel Daemons guide](https://vercel.com/kb/guide/migrate-fly-io-workers-to-vercel-daemons)
  

## Frequently asked questions

### Is Fly.io Sprites a microVM like Vercel Sandbox?

Yes. Fly.io runs each Sprite as a Firecracker microVM with its own kernel and filesystem, and says user code runs in an inner container inside that VM. Vercel Sandbox also gives every sandbox its own Firecracker microVM and kernel. The two differ in how you reach, size, and persist a sandbox.

### Can I use these sandboxes outside Vercel or Fly.io?

Yes. Vercel Sandbox works from any environment that can run its SDKs or call the Vercel REST API. Outside Vercel, authenticate with a Vercel access token plus your team and project IDs. You can also control Sprites from anywhere with the sprite CLI, the Sprites REST API, or the SDKs for JavaScript, Python, Go, and Elixir, using a token that belongs to your Fly.io organization.

### What happens to my files when a sandbox stops or pauses?

Both preserve files between sessions by default. Vercel restores the latest saved snapshot, subject to retention settings; `persistent: false` discards files on stop. Sprites sync files to durable storage and keep them through pauses.

Processes resume after a warm Sprite wake. After a cold wake, registered Services start again. Vercel resumes from files without restoring processes, so use a lifecycle hook to start them again.

### Does Fly.io Sprites have internet access by default?

Yes. Sprites can reach external domains until you enforce a DNS-based network policy through the API. Vercel Sandbox also allows outbound access by default. Its firewall can switch to deny-all or a user-defined allow list while code runs.

### Can I run Docker in Vercel Sandbox and Fly.io Sprites?

Yes on both. Vercel Sandbox runs Docker and other system-level tools with sudo inside the microVM. Fly.io [says Docker runs inside a Sprite](https://fly.io/learn/sprites-vs-e2b-vs-modal-vs-daytona), which is a full Linux VM where you get root. Docker isn't in the documented list of preinstalled tools, so install it first.

Containers inside Vercel Sandbox must [trust its proxy CA certificate](https://vercel.com/docs/sandbox/concepts/security#trust-the-proxy-ca-in-containers) when calling domains with request-modifying firewall rules, such as credential injection.

### Can I run Python in Vercel Sandbox and Fly.io Sprites?

Yes. Vercel's universal image includes Python 3.14, and a dedicated Python image is also available. The `vercel-sandbox` client requires Python 3.11 or later. Sprites comes with Python, and its `sprites-py` client requires Python 3.9 or later. Both clients offer synchronous and asynchronous APIs.

### Can I use either product as an AI code interpreter?

Yes. Both can sandbox AI-generated code for tasks such as data analysis. Use [Vercel's SDKs](https://vercel.com/docs/sandbox#using-vercel-sandbox) from your backend, or create Sprites and run commands in them with [Fly.io's SDKs or REST API](https://docs.fly.io/sprites). Restrict either agent sandbox's files, credentials, and network access to what the task requires.

### Which regions do Vercel Sandbox and Fly.io Sprites run in?

Vercel offers 19 regions, chosen per sandbox or through a project default. For Sprites, confirm available regions and placement controls with Fly.io before committing to a latency or residency requirement.

### Can I use Vercel Sandbox with eve, Mastra, or Flue?

Yes. eve includes a Vercel Sandbox provider, Mastra offers VercelSandbox from @mastra/vercel, and Flue provides useSandbox(). These integrations let the framework use Vercel Sandbox for command and file operations. Fly.io's ecosystem page also lists a Mastra integration for Sprites, so compatibility alone may not decide the choice.

## More Vercel Sandbox guides

- [Vercel Sandbox vs CodeSandbox](/kb/guide/vercel-sandbox-vs-codesandbox): A detailed guide to Vercel Sandbox vs CodeSandbox: compute isolation, credential brokering, Active CPU billing, Docker support, persistent environments, and when to choose each product for your AI workloads.
- [Vercel Sandbox vs E2B](/kb/guide/vercel-sandbox-vs-e2b): A detailed guide to Vercel Sandbox vs E2B: compute lifecycle, security controls, code execution, pricing, and when to choose each sandbox for your AI agent workloads.
- [Vercel Sandbox vs Upstash Box](/kb/guide/vercel-sandbox-vs-upstash-box): Compare Vercel Sandbox and Upstash Box as AI agent sandboxes, including isolation, persistence, network controls, SDKs, and deployment regions.

## 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)

## Search guides from your terminal

Search the Knowledge Base and read guides as Markdown with the Vercel CLI. No login required.

```bash
# Find guides by keyword
npx vercel@latest kb search "rewrites and redirects"
npx vercel@latest kb search "AI SDK streaming"

# Show the latest guides
npx vercel@latest kb

# Print a guide as Markdown, by slug or URL
npx vercel@latest kb inspect <guide>
```
