
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
@vercel/sandbox
Advanced tools
Vercel Sandbox allows you to run arbitrary code in isolated, ephemeral Linux VMs. View the documentation here.
@vercel/sandbox (this package) - The SDK for programmatic access to Vercel Sandbox. Source | Documentationsandbox - The CLI for interacting with Vercel Sandbox from the command line. Source | DocumentationA sandbox is an isolated Linux system for your experimentation and use. Internally, it is a Firecracker MicroVM that is powered by the same infrastructure that powers 2M+ builds a day at Vercel.
To get started using Node.js 22+, create a new project:
mkdir my-sandbox-app && cd my-sandbox-app
npm init -y
vercel link
Pull your authentication token:
vercel env pull
Install the Sandbox SDK:
pnpm i @vercel/sandbox
Create a index.mts file:
import { Sandbox } from "@vercel/sandbox";
import { setTimeout } from "timers/promises";
import { spawn } from "child_process";
async function main() {
const sandbox = await Sandbox.create({
source: {
url: "https://github.com/vercel/sandbox-example-next.git",
type: "git",
},
resources: { vcpus: 4 },
ports: [3000],
runtime: "node24",
name: "vercel-sandbox-example",
});
console.log(`Sandbox ${sandbox.name} created`);
console.log(`Installing dependencies...`);
const install = await sandbox.runCommand({
cmd: "npm",
args: ["install", "--loglevel", "info"],
stderr: process.stderr,
stdout: process.stdout,
});
if (install.exitCode !== 0) {
console.log("installing packages failed");
process.exit(1);
}
console.log(`Starting the development server...`);
await sandbox.runCommand({
cmd: "npm",
args: ["run", "dev"],
stderr: process.stderr,
stdout: process.stdout,
detached: true,
});
await setTimeout(500);
spawn("open", [sandbox.domain(3000)]);
}
main().catch(console.error);
Run it:
node --experimental-strip-types --env-file .env.local index.mts
This will:
next dev serverAll while streaming logs to your local terminal.
Sandboxes are persistent by default. To resume a sandbox with its previous state:
Create a resume.mts file:
import { Sandbox } from "@vercel/sandbox";
import { setTimeout } from "timers/promises";
import { spawn } from "child_process";
async function main() {
const sandbox = await Sandbox.get({
name: "vercel-sandbox-example",
});
console.log(`Sandbox ${sandbox.name} resumed`);
console.log(`Starting the development server...`);
await sandbox.runCommand({
cmd: "npm",
args: ["run", "dev"],
stderr: process.stderr,
stdout: process.stdout,
detached: true,
});
await setTimeout(500);
spawn("open", [sandbox.domain(3000)]);
}
main().catch(console.error);
Run it:
node --experimental-strip-types --env-file .env.local resume.mts
The SDK uses Vercel OIDC tokens to authenticate whenever available. This is the most straightforward and recommended way to authenticate.
When developing locally, you can download a development token to .env.local
using vercel env pull. After 12 hours the development token expires, meaning
you will have to call vercel env pull again.
In production, Vercel manages token expiration for you.
If you want to use the SDK from an environment where VERCEL_OIDC_TOKEN is
unavailable, you can also authenticate using an access token:
Set your team ID, project ID, and token to the environment variables
VERCEL_TEAM_ID, VERCEL_PROJECT_ID, and VERCEL_TOKEN. Then pass these to
the create method:
const sandbox = await Sandbox.create({
teamId: process.env.VERCEL_TEAM_ID!,
projectId: process.env.VERCEL_PROJECT_ID!,
token: process.env.VERCEL_TOKEN!,
source: {
url: "https://github.com/vercel/sandbox-example-next.git",
type: "git",
},
resources: { vcpus: 4 },
// Defaults to 5 minutes. The maximum is 5 hours for Pro/Enterprise, and 45 minutes for Hobby.
timeout: ms("5m"),
ports: [3000],
runtime: "node24",
});
Sandbox and CommandFinished support serialization with the
Workflow DevKit. When a sandbox instance
crosses a step boundary the SDK serializes sandbox metadata and routes, then
rehydrates synchronously from that snapshot. Deserialized instances lazily
recreate an API client using OIDC or environment credentials when needed.
timeout option of Sandbox.create().The base system is an Amazon Linux 2023 system with the following additional packages installed.
bind-utils
bzip2
findutils
git
gzip
iputils
libicu
libjpeg
libpng
ncurses-libs
openssl
openssl-libs
procps
tar
unzip
which
whois
zstd
node24 and node22 images ship Node runtimes under /vercel/runtimes/node{22,24}.python3.13 image ships a Python 3.13 runtime under /vercel/runtimes/python.vercel-sandbox user./vercel/sandbox is writable.The nodeX and python3.13 images allow users to run commands as root. This
can be used to install packages and system tools:
import { Sandbox } from "@vercel/sandbox";
const sandbox = await Sandbox.create();
await sandbox.runCommand({
cmd: "dnf",
args: ["install", "-y", "golang"],
sudo: true,
});
Sandbox runs sudo in the following configuration:
HOME is set to /root – Executed commands will source root's configuration
files (e.g. .gitconfig, .bashrc, etc).PATH is left unchanged – sudo won't change the value of PATH, so local or
project-specific binaries will still be found.Both these images are based on Amazon Linux 2023. The full package list is available here.
This library is created by Vercel team members, with contributions from the Open Source Community welcome and highly appreciated.
FAQs
Software Development Kit for Vercel Sandbox
The npm package @vercel/sandbox receives a total of 1,992,432 weekly downloads. As such, @vercel/sandbox popularity was classified as popular.
We found that @vercel/sandbox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.