Skip to content
Menu

Working with Sandbox

Last updated March 10, 2026

This page covers common tasks when working with Vercel Sandbox.

Persistent sandboxes are available in beta. They automatically save state when stopped and resume where you left off, so you don't need to manage snapshots manually. Install @vercel/sandbox@beta or sandbox@beta to try them.

By default, sandboxes timeout after 5 minutes. For longer tasks, set a custom timeout when creating the sandbox:

import { Sandbox } from '@vercel/sandbox';
 
const sandbox = await Sandbox.create({
  timeout: 3 * 60 * 60 * 1000, // 3 hours
});
from vercel.sandbox import Sandbox
 
sandbox = Sandbox.create(
    timeout=3 * 60 * 60 * 1000,  # 3 hours
)

To extend a running sandbox, call extendTimeout:

import { Sandbox } from '@vercel/sandbox';
 
const sandbox = await Sandbox.create();
await sandbox.extendTimeout(2 * 60 * 60 * 1000); // Add 2 hours
from vercel.sandbox import Sandbox
 
sandbox = Sandbox.create()
sandbox.extend_timeout(2 * 60 * 60 * 1000)  # Add 2 hours

See Pricing and Limits for maximum durations by plan.

Connect to a running sandbox for interactive debugging with an SSH-like experience:

sandbox connect <sandbox-id>

Once connected, you have full shell access to inspect logs, check processes, and explore the filesystem.

See CLI Reference for all options.

View your sandboxes in the Sandboxes dashboard. For each project, you can see:

  • Total sandboxes created
  • Currently running sandboxes
  • Stopped sandboxes
  • Command history and sandbox URLs

Track compute usage across projects in the Usage dashboard, which measures:

  • Sandbox Provisioned Memory: Memory allocated to your sandboxes
  • Sandbox Data Transfer: Data transferred in and out
  • Sandbox Active CPU: CPU time consumed
  • Sandbox Creations: Number of sandboxes created
  • Snapshot Storage: Sandbox snapshot storage

There are three ways to stop a sandbox:

  1. Go to Sandboxes in Observability.
  2. Select your sandbox.
  3. Click Stop Sandbox.
import { Sandbox } from '@vercel/sandbox';
 
const sandbox = await Sandbox.create();
// ... do work ...
await sandbox.stop();
from vercel.sandbox import Sandbox
 
sandbox = Sandbox.create()
# ... do work ...
sandbox.stop()

Sandboxes stop automatically when their timeout expires. The default is 5 minutes.


Was this helpful?

supported.