Working with Sandbox
This page covers common tasks when working with Vercel Sandbox.
By default, sandboxes timeout after 5 minutes. For longer tasks, set a custom timeout when creating the sandbox:
To extend a running sandbox, call extendTimeout:
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
- Sandbox Storage: Sandbox snapshot storage
There are three ways to stop a sandbox:
- Go to Sandboxes in Observability.
- Select your sandbox.
- Click Stop Sandbox.
Sandboxes stop automatically when their timeout expires. The default is 5 minutes.
Reconnect to a running sandbox
Learn how to use Sandbox.get() to reconnect to an existing sandbox from a different process or after a script restart.
Execute AI-generated code safely
Learn how to run code generated by AI models in an isolated sandbox environment.
Run a web server
Learn how to start a web server inside a sandbox and access it via a public URL.
Clone and build from Git
Learn how to create a sandbox pre-loaded with code from a Git repository, including private repos.
Install system packages
Learn how to install additional system packages in Vercel Sandbox using dnf, the package manager for Amazon Linux 2023.
Use with Claude Agent SDK
Learn how to deploy Claude's Agent SDK in Vercel Sandbox for secure and isolated execution of AI-powered code generation and autonomous agent tasks.
Run AI-generated code
How to execute untrusted, AI-generated code inside Vercel Sandbox - an isolated, ephemeral environment.
Was this helpful?