Skip to main content
Agent skill

Vercel Sandbox

Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include "Vercel Sandbox browser", "microVM Chrome", "agent-browser in sandbox", "browser automation on Vercel", or any task requiring Chrome in a Vercel Sandbox.

Get started

Get the complete skill folder, including its scripts and reference files.

When to use this skill

Use Vercel Sandbox when an AI agent needs a reusable SKILL.md workflow for this job: Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include "Vercel Sandbox browser", "microVM Chrome", "agent-browser in sandbox", "browser automation on Vercel", or any task requiring Chrome in a Vercel Sandbox.

When not to use it

Skip Vercel Sandbox when the task is outside the productivity category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.

How to install

Where will you use it?

Install scope
Claude Code folder setup
mkdir -p ~/.claude/skills/vercel-sandbox
# Save SKILL.md to ~/.claude/skills/vercel-sandbox/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/vercel-sandbox/SKILL.md. For a shared project, commit the folder at .claude/skills/vercel-sandbox/ instead.
  2. Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
  3. For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.

Full install guide for Claude, Cursor, and Codex →

Try a starter prompt

After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.

Starter prompt
Use the Vercel Sandbox skill for this task: Use Vercel Sandbox when this documented workflow matches the task. Confirm any required inputs or files before making changes.

What supports this recommendation?

71/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.

Documentation
77/100
Practical detail
68/100
Source evidence
63/100
Source signals
72/100
Model compatibility evidence
  • claudeuntested

    No model-specific signal or recorded compatibility test was found.

  • chatgptuntested

    No model-specific signal or recorded compatibility test was found.

  • geminiuntested

    No model-specific signal or recorded compatibility test was found.

  • copilotuntested

    No model-specific signal or recorded compatibility test was found.

  • llamauntested

    No model-specific signal or recorded compatibility test was found.

  • perplexityuntested

    No model-specific signal or recorded compatibility test was found.

  • mistraluntested

    No model-specific signal or recorded compatibility test was found.

  • grokuntested

    No model-specific signal or recorded compatibility test was found.

Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.

What this skill does

# Browser Automation with Vercel Sandbox

Run agent-browser + headless Chrome inside ephemeral Vercel Sandbox microVMs. A Linux VM spins up on demand, executes browser commands, and shuts down. Works with any Vercel-deployed framework (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.).

## Dependencies

```bash pnpm add @agent-browser/sandbox @vercel/sandbox ```

The sandbox VM needs system dependencies for Chromium plus agent-browser itself. The `@agent-browser/sandbox` helpers install them by default for fresh sandboxes and use sandbox snapshots (below) for sub-second startup. Pass `installSystemDependencies: false` only when the sandbox image already provides Chromium's required libraries.

## Core Pattern

```ts import { createAgentBrowserSnapshot, runAgentBrowserCommand, withAgentBrowserSandbox, type VercelSandboxSession, } from "@agent-browser/sandbox/vercel";

async function withBrowser<T>( fn: (sandbox: VercelSandboxSession) => Promise<T>, ): Promise<T> { return withAgentBrowserSandbox(fn); } ```

## Screenshot

The `screenshot --json` command saves to a file and returns the path. Read the file back as base64:

```ts export async function screenshotUrl(url: string) { return withBrowser(async (sandbox) => { await runAgentBrowserCommand(sandbox, ["open", url]);

const titleResult = await runAgentBrowserCommand<{ data?: { title?: string } }>(sandbox, [ "get", "title", ]); const title = titleResult.json?.data?.title || url;

const ssResult = await runAgentBrowserCommand<{ data?: { path?: string } }>(sandbox, [ "screenshot", ]); const ssPath = ssResult.json?.data?.path; if (!ssPath) throw new Error("Screenshot did not return a file path."); const b64Result = await sandbox.runCommand("base64", ["-w", "0", ssPath]); const screenshot = (await b64Result.stdout()).trim();

await runAgentBrowserCommand(sandbox, ["close"], { json: false });

return { title, screenshot }; }); } ```

## Accessibility Snapshot

```ts export async function snapshotUrl(url: string) { return withBrowser(async (sandbox) => { await runAgentBrowserCommand(sandbox, ["open", url]);

const titleResult = await runAgentBrowserCommand<{ data?: { title?: string } }>(sandbox, [ "get", "title", ]); const title = titleResult.json?.data?.title || url;

const snapResult = await runAgentBrowserCommand(sandbox, ["snapshot", "-i", "-c"], { json: false, });

await runAgentBrowserCommand(sandbox, ["close"], { json: false });

return { title, snapshot: snapResult.stdout }; }); } ```

## Multi-Step Workflows

The sandbox persists between commands, so you can run full automation sequences:

```ts export async function fillAndSubmitForm( url: string, data: Record<string, string>, postSubmitWaitArgs: string[], ) { return withBrowser(async (sandbox) => { await runAgentBrowserCommand(sandbox, ["open", url]);

const snapResult = await runAgentBrowserCommand(sandbox, ["snapshot", "-i"], { json: false, }); const snapshot = snapResult.stdout; // Parse snapshot to find element refs...

for (const [ref, value] of Object.entries(data)) { await runAgentBrowserCommand(sandbox, ["fill", ref, value]); }

await runAgentBrowserCommand(sandbox, ["click", "@e5"]); // Pass an app-specific wait, such as ["--url", "**/checkout/complete"], // ["--text", "Thanks"], or ["#confirmation"]. await runAgentBrowserCommand(sandbox, ["wait", ...postSubmitWaitArgs]);

const ssResult = await runAgentBrowserCommand<{ data?: { path?: string } }>(sandbox, [ "screenshot", ]); const ssPath = ssResult.json?.data?.path; if (!ssPath) throw new Error("Screenshot did not return a file path."); const b64Result = await sandbox.runCommand("base64", ["-w", "0", ssPath]); const screenshot = (await b64Result.stdout()).trim();

await runAgentBrowserCommand(sandbox, ["close"], { json: false });

return { screenshot }; }); } ```

## MCP Server over stdin

For many MCP tool calls in one sandbox, `startAgentBrowserMcp` keeps one `agent-browser mcp` process running and sends requests over the sandbox command's stdin. It requires `@vercel/sandbox` 3.7 or later, and `timeout` (milliseconds) applies to each request and to `close()`:

```ts import { startAgentBrowserMcp, withAgentBrowserSandbox } from "@agent-browser/sandbox/vercel";

const snapshot = await withAgentBrowserSandbox(async (sandbox) => { const mcp = await startAgentBrowserMcp(sandbox, { timeout: 60_000 }); try { await mcp.callTool("agent_browser_open", { url: "https://example.com" }); return await mcp.callTool("agent_browser_snapshot", { interactive: true }); } finally { await mcp.close(); } }); ```

## Sandbox Snapshots (Fast Startup)

A **sandbox snapshot** is a saved VM image of a Vercel Sandbox with system dependencies + agent-browser + Chromium already installed. Think of it like a Docker image: instead of installing dependencies from scratch every time, the sandbox boots from the pre-built image.

This is unrelated to agent-browser's *accessibility snapshot* feature (`agent-browser snapshot`), which dumps a page's accessibility tree. A sandbox snapshot is a Vercel infrastructure concept for fast VM startup.

Without a sandbox snapshot, each run installs system deps + agent-browser + Chromium (~30s). With one, startup is sub-second.

### Creating a sandbox snapshot

The snapshot must include system dependencies (via `dnf`), agent-browser, and Chromium:

```ts const snapshotId = await createAgentBrowserSnapshot(); ```

Run this once, then set the environment variable:

```bash AGENT_BROWSER_SNAPSHOT_ID=snap_xxxxxxxxxxxx ```

A helper script is available in the demo app:

```bash npx tsx examples/environments/scripts/create-snapshot.ts ```

Recommended for any production deployment using the Sandbox pattern.

## Authentication

On Vercel deployments, the Sandbox SDK authenticates automatically via OIDC. For local development or explicit control, set:

```bash VERCEL_TOKEN=<personal-access-token> VERCEL_TEAM_ID=<team-id> VERCEL_PROJECT_ID=<project-id> ```

These are spread into `Sandbox.create()` calls. When absent, the SDK falls back to `VERCEL_OIDC_TOKEN` (automatic on Vercel).

## Scheduled Workflows (Cron)

Combine with Vercel Cron Jobs for recurring browser tasks:

```ts // app/api/cron/route.ts (or equivalent in your framework) export async function GET() { const result = await withBrowser(async (sandbox) => { await sandbox.runCommand("agent-browser", ["open", "https://example.com/pricing"]); const snap = await sandbox.runCommand("agent-browser", ["snapshot", "-i", "-c"]); await sandbox.runCommand("agent-browser", ["close"]); return await snap.stdout(); });

// Process results, send alerts, store data... return Response.json({ ok: true, snapshot: result }); } ```

```json // vercel.json { "crons": [{ "path": "/api/cron", "schedule": "0 9 * * *" }] } ```

## Environment Variables

| Variable | Required | Description | |---|---|---| | `AGENT_BROWSER_SNAPSHOT_ID` | No (but recommended) | Pre-built sandbox snapshot ID for sub-second startup (see above) | | `VERCEL_TOKEN` | No | Vercel personal access token (for local dev; OIDC is automatic on Vercel) | | `VERCEL_TEAM_ID` | No | Vercel team ID (for local dev) | | `VERCEL_PROJECT_ID` | No | Vercel project ID (for local dev) |

## Framework Examples

The pattern works identically across frameworks. The only difference is where you put the server-side code:

| Framework | Server code location | |---|---| | Next.js | Server actions, API routes, route handlers | | SvelteKit | `+page.server.ts`, `+server.ts` | | Nuxt | `server/api/`, `server/routes/` | | Remix | `loader`, `action` functions | | Astro | `.astro` frontmatter, API routes |

## Example

See `examples/environments/` in the agent-browser repo for a working app with the Vercel Sandbox pattern, including a sandbox snapshot creation script, streaming progress UI, and rate limiting.

Intended uses

  • Use Vercel Sandbox when this documented workflow matches the task.

Implementation notes

  • Review the source instructions and adapt inputs before running the workflow.

Try it, then tell us how it went

A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.