---
title: Vercel Sandbox vs Freestyle VMs
description: Compare Vercel Sandbox and Freestyle VMs as AI agent sandboxes, including isolation, persistence, network controls, SDKs, and deployment regions.
keywords: ["Vercel Sandbox","Freestyle","AI agent sandbox","untrusted code execution","Firecracker microVM"]
url: "https://vercel.com/kb/guide/vercel-sandbox-vs-freestyle-vms"
published: 2026-11-24
last_updated: 2026-11-24
authors: Ben Sabic
related_resources:
  - title: "Vercel Sandbox vs Cloudflare Sandbox"
    url: "/kb/guide/vercel-sandbox-vs-cloudflare-sandbox"
    description: "Compare Vercel Sandbox and Cloudflare Sandbox as AI agent sandboxes, including isolation, persistence, network controls, SDKs, and deployment options."
  - title: "Vercel Sandbox vs Upstash Box"
    url: "/kb/guide/vercel-sandbox-vs-upstash-box"
    description: "Compare Vercel Sandbox and Upstash Box as AI agent sandboxes, including isolation, persistence, network controls, SDKs, and deployment regions."
  - title: "Vercel Sandbox vs Modal Sandboxes"
    url: "/kb/guide/vercel-sandbox-vs-modal-sandboxes"
    description: "Compare Vercel Sandbox and Modal Sandboxes as AI agent sandboxes, including isolation, persistence, network controls, GPUs, SDKs, and deployment regions."
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-freestyle-vms"
---

[Vercel Sandbox](https://vercel.com/docs/sandbox) and [Freestyle VMs](https://www.freestyle.sh/docs) are AI sandboxes for running generated code in Linux virtual machines with their own kernels. Vercel runs each sandbox in a Firecracker microVM. Freestyle says it runs its micro-VMs on [its own KVM hypervisor written in Rust](https://www.freestyle.sh/careers).

Choose Vercel Sandbox for Python SDK access, reusable Drives, or regional deployment controls. It also supports managed npm credentials and custom OCI images. Freestyle fits long-running VMs that preserve processes and memory when paused, with network access configured through allow rules.

## How Vercel Sandbox and Freestyle compare

### Compute and resources

Vercel gives each sandbox [its own Firecracker microVM and kernel](https://vercel.com/docs/sandbox/concepts/security). Freestyle describes each VM as having [a full kernel with support for FUSE and eBPF](https://www.freestyle.sh/), with root access, Docker, and nested virtualization inside it.

| Concern                 | Vercel Sandbox                                                                                                                                                                                                           | Freestyle                                                                                                                                                                       |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Isolation               | Firecracker microVM with its own kernel                                                                                                                                                                                  | Micro-VM with its own kernel, on a KVM hypervisor Freestyle builds in Rust                                                                                                      |
| Base environment        | [Managed images](https://vercel.com/docs/sandbox/concepts/images) built on Ubuntu 26.04 (the default universal image has Node.js 24 and Python 3.14) or Arch Linux, or a custom OCI image from Vercel Container Registry | [`freestyle/ubuntu`](https://www.freestyle.sh/docs/vms/base-snapshots), Ubuntu 24.04 LTS with Docker, Node.js, Bun, Python, uv, and coding agents, plus Kali and BusyBox images |
| vCPUs                   | 1 or even numbers; default 2. Limits: 4 (Hobby), 8 (Pro), 32 (Enterprise).                                                                                                                                               | Default 4. Per-VM maximums: 4 (Free), 8 (Hobby), 32 (Pro).                                                                                                                      |
| Memory                  | 2 GB per vCPU, up to 8 GB on Hobby, 16 GB on Pro, 64 GB on Enterprise                                                                                                                                                    | Default 8 GiB. Per-VM maximums: 8 GiB (Free), 16 GiB (Hobby), 64 GiB (Pro).                                                                                                     |
| Disk                    | 64 GB NVMe; SDK 3.0.0+ or custom image                                                                                                                                                                                   | Default 32 GB. Published per-VM limits: 32 GB on Free, 64 GB on Hobby, and 256 GB on Pro. Enterprise limits are custom.                                                         |
| Concurrent environments | Hobby: 10. Pro and Enterprise: 10,000.                                                                                                                                                                                   | Free: 10. Hobby: 40. Pro: 400. Enterprise: custom limits. Paused VMs don't count.                                                                                               |
| SDKs and tools          | TypeScript SDK, sync/async Python SDK, Sandbox CLI, Vercel CLI, and Vercel REST API                                                                                                                                      | TypeScript SDK and CLI in the `freestyle` npm package                                                                                                                           |
| Authentication          | Project-scoped Vercel OIDC token, or an access token with team and project IDs                                                                                                                                           | Account API key in `FREESTYLE_API_KEY`; the CLI also signs in through the browser                                                                                               |
| Plan                    | Hobby, Pro, and Enterprise                                                                                                                                                                                               | Free, Hobby, Pro, and Enterprise                                                                                                                                                |

Plan names differ across providers, so compare their limits for your workload. Freestyle's disk can grow after creation. Vercel's 64 GB root filesystem requires Sandbox SDK 3.0.0+ or a custom image; deprecated runtimes receive 32 GB.

Freestyle's [Ubuntu images](https://www.freestyle.sh/docs/vms/base-snapshots) run `vm.exec()` as the `ubuntu` user, with passwordless sudo for system changes.

### Lifecycle

Vercel saves a persistent sandbox's filesystem when its session ends. Freestyle can keep a VM running until a configured policy or your code stops it, and pausing preserves its memory and processes.

| Concern               | Vercel Sandbox                                                                                                                                                         | Freestyle                                                                                                                          |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| Session end           | Default 5 minutes. Extend to 45 minutes on Hobby or 24 hours on Pro and Enterprise with `sandbox.extendTimeout()`.                                                     | No fixed session maximum is documented. Configure run budgets, idle pausing, and deletion policies.                                |
| What keeps it running | The session timeout, which your code can extend                                                                                                                        | The VM runs until a lifetime field, an idle timeout, `vm.pause()`, or a power-off inside the guest ends the run                    |
| State kept by default | Filesystem and configuration [snapshotted on stop](https://vercel.com/docs/sandbox/concepts/persistent-sandboxes)                                                      | Memory and disk while paused. Persistent VMs keep their disk after they stop.                                                      |
| Running processes     | Not restored on resume                                                                                                                                                 | Resume where they left off after a pause. Lost when the VM stops.                                                                  |
| How it resumes        | An SDK operation that requires a running VM, such as `runCommand()`, starts a new session from the latest snapshot                                                     | `vm.start()`, a file write through `vm.fs`, or, after an idle-timeout pause, the next traffic that reaches the VM                  |
| Snapshots             | Automatic when a persistent session stops. Manual `snapshot()` also stops the session. Snapshots expire 30 days after last use by default; expiration is configurable. | Manual with `vm.snapshot()` from a running or paused VM. Captures memory and disk, and is kept until you delete it.                |
| Forks                 | `Sandbox.fork()` uses the current saved snapshot, without capturing unsaved session changes. Pass Drive mounts explicitly.                                             | Freestyle describes live copies without pausing. Its SDK documents `vm.snapshot()`, followed by creating VMs from the snapshot ID. |
| Disposable mode       | `persistent: false` discards the filesystem when the session stops                                                                                                     | `autoDeleteSeconds: 0` makes the VM ephemeral, so it's deleted when it stops                                                       |

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 it with an operation such as `runCommand()` before sending traffic.

On Freestyle, a [paused VM](https://www.freestyle.sh/docs/vms/lifecycle) holds its disk and saved memory and doesn't count against the concurrent VM limit. You can read its files through `vm.fs` without resuming it. Stopping a persistent VM keeps its disk but discards its memory. Ephemeral VMs are deleted on stop.

Measure startup from creation through the same first command or file operation, using the region where your application runs. Vendor headline timings do not establish an equivalent workload comparison.

### Networking and security

Vercel Sandbox allows outbound internet access by default and uses a declarative firewall to restrict it. Freestyle requires a `firewall` configuration at creation. Empty rules block ordinary inbound and outbound connections, while managed domain forwarding and authenticated SSH remain available.

| Concern              | Vercel Sandbox                                                                                                                        | Freestyle                                                                                                                                                                                                                                   |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Default egress       | Allow all                                                                                                                             | None. The `firewall` block is required at creation.                                                                                                                                                                                         |
| Egress controls      | [Firewall](https://vercel.com/docs/sandbox/concepts/firewall): allow-all (default), deny-all (blocks DNS), or custom allow/deny lists | Allow-only firewall rules that match a VM, private network, tunnel, CIDR range, or the public internet, with an optional port and protocol. [TLS rules](https://www.freestyle.sh/docs/vms/network/tls-outbound) allow named domains by SNI. |
| Runtime updates      | Policy updates apply without a process restart                                                                                        | Create rules for an existing VM with `freestyle.firewall.rules.create()` or `freestyle firewall create`                                                                                                                                     |
| Credential injection | Brokering rules on allowed domains that match path, method, query parameters, and headers; change rules at runtime                    | TLS rules can match methods and exact paths before injecting credentials or transforming JSON. Supported credential mechanisms include headers, OAuth bearer tokens, S3 signing, and Postgres authentication.                               |
| Inbound access       | Up to 15 ports, each with its own URL that anyone with the URL can reach                                                              | A TLS rule routes a public HTTPS domain to a guest port, using a free `style.dev` subdomain or a verified domain of your own                                                                                                                |
| Private networks     | [Secure Compute](https://vercel.com/docs/sandbox/concepts/secure-compute) network with AWS VPC peering, an Enterprise feature         | Private networks (VPCs) attached at creation, and WireGuard tunnels to remote networks                                                                                                                                                      |
| Compliance           | SOC 2 Type II certified infrastructure; snapshots encrypted at rest                                                                   | Confirm Freestyle's certifications and audit scope with Freestyle                                                                                                                                                                           |

Freestyle blocks direct outbound TCP connections to public internet ports 25, 465, and 587 regardless of the VM's firewall rules.

Credentials in a sandbox's environment are visible to code running there. Use Vercel's [credential injection rules](https://vercel.com/docs/sandbox/concepts/firewall) or Freestyle's [TLS rule transforms](https://www.freestyle.sh/docs/vms/network/tls-outbound) to keep supported secrets outside the environment. Code can still make authorized requests, so restrict its destinations and permissions.

Ordinary domain allowlists on both products check the TLS hostname without inspecting the encrypted HTTP `Host` header. If the destination accepts a mismatch, traffic can reach another host behind that endpoint. Use request-level host enforcement or a validating proxy to prevent [domain fronting](https://vercel.com/docs/sandbox/concepts/firewall#http-and-https).

### Regions

Vercel Sandbox supports [19 regions](https://vercel.com/docs/sandbox/concepts/regions), with selection per sandbox or project. The default is `iad1` in Washington, D.C. Pro and Enterprise teams can configure failover regions, excluding Pro trials. CPU, memory, and data-transfer rates vary by region.

Freestyle's public docs do not list deployment regions or a region selector. Confirm where VMs, saved memory, and snapshots are stored before relying on the service for a specific 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. Follow the [local setup](#get-started-with-vercel-sandbox) to install the SDK and load the token.
  
- For Freestyle, follow its [quickstart](https://www.freestyle.sh/docs/quickstart) to install `freestyle` and create an API key. Save the key as `FREESTYLE_API_KEY` in your local environment file.
  

Save the examples as `sandbox.mjs` and `freestyle.mjs`. Each prints the Node.js version, writes a file, and reads it back. Both allow outbound internet access; their cleanup behavior differs as explained below.

**Vercel Sandbox**

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

const sandbox = await Sandbox.create();

try {
  const result = await sandbox.runCommand('node', ['--version']);
  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();
}
```

**Freestyle**

```javascript
import { Freestyle } from "freestyle";

const freestyle = new Freestyle();

const { vm } = await freestyle.vms.create({
  // Allow outbound internet access for this VM.
  firewall: {
    rules: [
      {
        action: "allow",
        source: {},
        destination: { public: true },
      },
    ],
  },
});

try {
  const result = await vm.exec("node --version");
  console.log(result.stdout);

  await vm.fs.writeTextFile("/tmp/hello.txt", "hi");
  const content = await vm.fs.readTextFile("/tmp/hello.txt");
  console.log(content);
} finally {
  await vm.delete();
}
```

`sandbox.stop()` ends the current session. Operations such as `runCommand()` resume a stopped persistent sandbox from its saved state; metadata lookups and configuration updates do not necessarily start a session. To discard files, create the Vercel sandbox with `persistent: false`.

Freestyle's [SDK docs](https://www.freestyle.sh/docs/vms) show no stop call, so the sample cleans up with `vm.delete()`, which removes the VM permanently. To keep the VM instead, call `vm.pause()`, which saves memory and running processes until `vm.start()`, or power it off from inside the guest. Freestyle's examples use absolute paths such as `/tmp/hello.txt`. Each `vm.exec()` call can run for at most five minutes, and Freestyle points to PTY sessions for longer interactive work.

Run the Freestyle file with its environment variables loaded:

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

Vercel's [Python SDK](https://vercel.com/docs/sandbox/sdk/python), `vercel-sandbox`, supports Python 3.11+ with sync and async APIs. Freestyle documents a TypeScript SDK and CLI.

## Where Vercel Sandbox goes deeper

### Python SDK and REST API

Call Vercel Sandbox from a Vercel Function, a CI job, a server on another host, or your own machine. On Vercel and in local development, the SDKs use the project's OIDC token. Elsewhere, pass an access token with the [team and project IDs](https://vercel.com/docs/sandbox/concepts/authentication). The [Sandbox CLI](https://vercel.com/docs/sandbox/sdk/cli) and the [Sandboxes endpoints in the Vercel REST API](https://vercel.com/docs/rest-api/sandboxes) create sandboxes and run commands from a terminal or an HTTP client.

Freestyle also supports API-key authentication from CI and other hosts. Its documented client is TypeScript, while Vercel provides a Python SDK and a REST API for callers in other languages.

### Drives

[Vercel Drives](https://vercel.com/docs/sandbox/concepts/drives) keep working files separate from the sandbox's starting environment. Mount up to four drives for workspaces or dependency caches and reuse their files in later sandboxes. The sandbox's main region must match the Drive's region. Each drive allows one writable mount, plus read-only snapshots for concurrent readers.

Freestyle keeps state on each VM's own disk and in snapshots of the whole machine, and `vm.fs` reads a paused VM's files.

### Request-level credential 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 domains with request-modifying rules, the firewall decrypts HTTPS and re-encrypts it with a certificate signed by the sandbox's own proxy certificate authority.

For private dependencies, [managed npm credentials](https://vercel.com/docs/sandbox/concepts/credentials) reuse your team's registry setup, including GitHub Packages and JFrog Artifactory. Set `credentials: { npm: true }` at creation. The firewall authenticates package downloads without placing tokens in the sandbox's `.npmrc`.

Configure registry credentials as team Shared Environment Variables in Development or Preview, and allow the registry hosts. The credentials cover package installation only; they do not authorize publishing.

Freestyle's [TLS rules](https://www.freestyle.sh/docs/vms/network/tls-outbound) can also match request methods and exact paths, inject credentials, and transform JSON bodies. Matching selects which requests receive the transforms; other requests can still reach the origin unchanged. Keep network grants narrow on either product.

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

Freestyle builds custom images from [snapshots](https://www.freestyle.sh/docs/vms/base-snapshots). Boot a base image, install what you need, and capture the VM with `vm.snapshot()`.

### Region selection and failover

Choose among 19 regions per sandbox or set a project default. On Pro and Enterprise, excluding Pro trials, [failover](https://vercel.com/docs/sandbox/concepts/regions) retries creation in another configured region when the main region has no capacity.

Failover can load Drives and snapshots across regions, and new snapshots stay in the failover region. Choose main and failover regions that meet your data-residency requirements. Freestyle does not document a region selector.

### Agent framework integrations

eve's [`eve/sandbox/vercel`](https://vercel.com/docs/frameworks/agents/eve) provider supports Vercel Sandbox and Drive mounts. [Mastra](https://vercel.com/docs/sandbox/ecosystem/mastra) and [Flue](https://vercel.com/docs/sandbox/ecosystem/flue) also integrate with Vercel Sandbox. The [ecosystem](https://vercel.com/docs/sandbox/ecosystem) includes LangChain, TanStack AI, and the OpenAI and Anthropic SDKs.

For hosted agent APIs, Vercel Sandbox integrates with [Gemini API Managed Agents](https://vercel.com/docs/sandbox/ecosystem/gemini-api) and the [OpenAI Agents API](https://vercel.com/docs/sandbox/ecosystem/openai-agents-api). Freestyle's [guides](https://www.freestyle.sh/docs/guides) cover giving an OpenAI agent a sandbox, running Claude Code, and using private Git repositories in a VM.

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

Freestyle's default Ubuntu image ships with `claude`, `codex`, `opencode`, and `openclaw` installed, and Freestyle's Claude Code guide runs the agent over a PTY session or with one-off prompts.

## Where Freestyle goes deeper

### Memory-preserving pause and live forks

`vm.pause()` freezes a Freestyle VM and saves its memory. `vm.start()` resumes the same processes at the same point, with open files and in-memory state intact, so a dev server or a half-finished agent task continues without a restart.

Freestyle [describes live forks](https://www.freestyle.sh/products/vms) that copy a running VM without pausing it. Its SDK documents taking a memory-and-disk snapshot, then creating copies from that snapshot ID. Vercel snapshots retain files, so processes need restarting.

### Long-running VMs with no fixed session limit

Freestyle separates a VM's total lifetime from the time it spends running. Set the [lifecycle policies](https://www.freestyle.sh/docs/vms/lifecycle) that match how long you need to keep it:

| Field                | Effect                                      |
| -------------------- | ------------------------------------------- |
| `ttlSeconds`         | Deletes the VM after its total lifetime     |
| `maxRunSeconds`      | Pauses the VM after one run's budget        |
| `maxRunTotalSeconds` | Pauses it after the cumulative run budget   |
| `autoDeleteSeconds`  | Deletes it after a period paused or stopped |

Account limits and automatic-deletion policy still apply. Paused VMs count toward saved-VM and disk quotas even though they do not count as running VMs.

Freestyle recommends its VMs for agent tasks that take hours, days, weeks, or months. Vercel sandboxes aren't designed to run continuously. Each session ends at its timeout, up to 24 hours on Pro and Enterprise, although a persistent sandbox can span any number of sessions.

### Default-deny networking with private networks and tunnels

Freestyle's allow-only firewall controls access through [private networks](https://www.freestyle.sh/docs/vms/network/firewall) and WireGuard tunnels. VPC membership alone grants no access, but managed domain forwarding and authenticated SSH work even with empty rules.

### Custom domains with managed HTTPS

Freestyle TLS rules route a public HTTPS domain to any guest port. The domain can be an unused `style.dev` subdomain, which is free and needs no verification, or a domain you've verified. Freestyle lists managed HTTPS for custom domains on its [homepage](https://www.freestyle.sh/). Vercel Sandbox gives each exposed port its own public URL.

### Nested virtualization

Freestyle can [run VMs inside a VM](https://www.freestyle.sh/products/vms). Vercel documents Docker, VPN clients, and FUSE with sudo, but not nested virtualization.

### Live resize and larger disks

`vm.resize()` increases a Freestyle VM's CPU, memory, or disk without recreating it. CPU and memory can grow live, and disk growth requires a running VM. Resources cannot shrink. Pro supports a 256 GB VM disk; Vercel provides a 64 GB root filesystem with separate storage available through Drives.

## 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 [Freestyle pricing](https://www.freestyle.sh/pricing).

## Choose by workload requirements

Compare the two agent sandboxes against your implementation requirements:

| Requirement                                                        | Product fit    | Reason                                                                                  |
| ------------------------------------------------------------------ | -------------- | --------------------------------------------------------------------------------------- |
| Control sandboxes through a Python SDK                             | Vercel Sandbox | Sync and async Python clients, plus a REST API for other languages                      |
| Custom OCI starting image                                          | Vercel Sandbox | Images from Vercel Container Registry                                                   |
| Private npm dependencies without tokens in the environment         | Vercel Sandbox | Managed npm credentials added by the firewall                                           |
| Workspaces mounted across sandboxes                                | Vercel Sandbox | Drives, up to four per sandbox                                                          |
| 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 400 concurrent environments on a published standard plan | Vercel Sandbox | 10,000 on Pro and Enterprise; Freestyle Pro allows 400 and Enterprise has custom limits |
| Resume with running processes and memory intact                    | Freestyle      | `vm.pause()` saves memory, and `vm.start()` resumes the same processes                  |
| One VM that runs for days with no session limit                    | Freestyle      | Lifetime fields you set, with no fixed maximum                                          |
| Nested virtualization                                              | Freestyle      | VMs inside a VM with KVM support                                                        |
| Root disk larger than 64 GB                                        | Freestyle      | Up to 256 GB per VM on Pro; Vercel Drives provide additional mounted storage            |

Both products put generated code behind a micro-VM boundary, so the choice usually comes down to how long environments live, what state survives a pause, and which language and region your application needs. For either AI agent sandbox, restrict the files, network destinations, and credentials available to generated code.

## 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) lets an agent read and save a team's shared files from Slack or a terminal. Each session gets a sandbox with a read-only Drive snapshot mounted at `/drive`.

The `save_to_drive` tool writes changes through a separate, short-lived sandbox with a read-write mount. Outbound network access is disabled for these sandboxes, keeping their commands from calling external services.

## Next steps

- Choose [how long sessions last and what persists](https://vercel.com/kb/guide/vercel-sandbox-duration-and-persistence)
  
- Restrict egress and broker credentials with the [Sandbox firewall](https://vercel.com/docs/sandbox/concepts/firewall)
  
- Boot from your own image with [custom images](https://vercel.com/docs/sandbox/concepts/images)
  
- Expose a dev server with [public ports](https://vercel.com/docs/sandbox/examples/expose-a-port)
  
- 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), [Upstash Box](https://vercel.com/kb/guide/vercel-sandbox-vs-upstash-box), and [Modal Sandboxes](https://vercel.com/kb/guide/vercel-sandbox-vs-modal-sandboxes)
  

## Frequently asked questions

### Is Freestyle a microVM like Vercel Sandbox?

Yes, both use virtual machines with their own kernels. Freestyle says its micro-VMs run on a KVM hypervisor it writes in Rust, and its docs don't name Firecracker. Vercel Sandbox boots every sandbox as a Firecracker microVM, so generated code never shares the host's kernel.

### Can I run Docker in a Vercel Sandbox or Freestyle VM?

Yes. Vercel Sandbox runs Docker with sudo inside its microVM. Freestyle's default Ubuntu image starts Docker at boot and supports nested virtualization.

Containers need the relevant proxy CA when they call an HTTPS service through rules that terminate TLS. Configure certificate trust inside the container using the [Vercel security guidance](https://vercel.com/docs/sandbox/concepts/security) or [Freestyle TLS guidance](https://www.freestyle.sh/docs/vms/network/tls-outbound). Ordinary TLS passthrough does not require this setup.

### Can I run Python in Vercel Sandbox and Freestyle?

Yes, inside both environments. Vercel's default universal image includes Python 3.14, a separate managed image pins Python, and the `vercel-sandbox` SDK lets apps on Python 3.11 or newer create and control sandboxes. Freestyle's Ubuntu image includes Python and uv, but Freestyle documents only a TypeScript SDK and CLI for creating and controlling VMs.

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

Vercel Sandbox saves a persistent sandbox's filesystem to a snapshot when the session ends, and the next SDK call that needs the VM restores it. Non-persistent Vercel sandboxes discard their files on stop, and running processes must be started again after any resume. Pausing a Freestyle VM keeps its memory, disk, and running processes until it starts again. Stopping one discards its memory and processes, and only persistent VMs keep their disk.

### Does Freestyle have internet access by default?

No outbound internet access is allowed until you configure it. Freestyle requires firewall rules at creation, but an empty list still permits managed domain forwarding and authenticated SSH. Allow public egress or selected TLS destinations as needed. Vercel Sandbox starts with outbound access enabled and supports deny-all or a custom allowlist.

### Can I use Vercel Sandbox or Freestyle as an AI code interpreter?

Yes. On Vercel Sandbox, write the model's script into the sandbox and run it with `runCommand()`, with egress denied or limited to the APIs the script needs. On Freestyle, run it with `vm.exec()`, keeping in mind that one call can last at most five minutes. Restrict sensitive files and external services before running model-generated code on either product.

### 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. eve's provider can also mount Vercel Drives in the sandboxes it creates.

## Related Resources

- [Vercel Sandbox vs Cloudflare Sandbox](/kb/guide/vercel-sandbox-vs-cloudflare-sandbox): Compare Vercel Sandbox and Cloudflare Sandbox as AI agent sandboxes, including isolation, persistence, network controls, SDKs, and deployment options.
- [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.
- [Vercel Sandbox vs Modal Sandboxes](/kb/guide/vercel-sandbox-vs-modal-sandboxes): Compare Vercel Sandbox and Modal Sandboxes as AI agent sandboxes, including isolation, persistence, network controls, GPUs, SDKs, and deployment regions.

## More Vercel Sandbox guides

- [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.
- [Vercel Sandbox vs Cloudflare Sandbox](/kb/guide/vercel-sandbox-vs-cloudflare-sandbox): Compare Vercel Sandbox and Cloudflare Sandbox as AI agent sandboxes, including isolation, persistence, network controls, SDKs, and deployment options.
- [Vercel Sandbox vs Modal Sandboxes](/kb/guide/vercel-sandbox-vs-modal-sandboxes): Compare Vercel Sandbox and Modal Sandboxes as AI agent sandboxes, including isolation, persistence, network controls, GPUs, 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>
```
