ASD

Vercel Sandbox

Ejecuta agent-browser + Chrome dentro de microVMs de Vercel Sandbox para automatización de navegador desde cualquier app desplegada en Vercel.

Oficial
Estrellas
40.5k

en todo el repo

Actividad
53

0–100, la ruta de este skill

Actualizado
el mes pasado

último commit aquí

Commits
2

últimos 90 días

Contexto
1.9k tok

137 tok en reposo

Paquete
1 archivo

8 KB

Instalar

Funciona con cualquier agente que lea SKILL.md

npx -y skills add vercel-labs/agent-browser --skill vercel-sandbox --agent claude-code

Se instala solo en este repositorio.

Este skill makes network requests.

Qué hace

  • Levanta agent-browser + Chrome headless dentro de microVMs de Vercel Sandbox, ejecutando comandos y cerrando el sandbox al terminar
  • Permite persistir sesiones de navegador entre múltiples comandos para flujos de automatización con varios pasos
  • Crea y usa sandbox snapshots (imagen de VM con dependencias, agent-browser y Chromium preinstalados) para arranque en menos de un segundo
  • Autentica automáticamente vía OIDC en despliegues de Vercel, o mediante VERCEL_TOKEN/VERCEL_TEAM_ID/VERCEL_PROJECT_ID en local
  • Se integra con Vercel Cron Jobs para tareas de navegador programadas y recurrentes

Úsalo cuando

  • Se necesita automatización de navegador dentro de una app desplegada en Vercel (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.)
  • Se quiere correr Chrome headless sin límites de tamaño de binario
  • Se necesitan sesiones de navegador persistentes entre comandos
  • Se quieren entornos de navegador aislados y efímeros

No lo uses cuando

    Qué lo activa

    Di cualquiera de estas frases y el agente debería cargar este skill.

    • Toma una captura de pantalla de esta URL usando Vercel Sandbox
    • Necesito automatizar el llenado de un formulario en mi app de Next.js con Chrome headless
    • Configura un cron job en Vercel que revise el snapshot de accesibilidad de esta página cada día
    • Crea un sandbox snapshot para que el arranque de agent-browser sea más rápido

    SKILL.md

    En inglés

    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

    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

    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:

    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

    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:

    export async function fillAndSubmitForm(url: string, data: Record<string, 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"]);
        await runAgentBrowserCommand(sandbox, ["wait", "--load", "networkidle"]);
    
        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 };
      });
    }
    

    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:

    const snapshotId = await createAgentBrowserSnapshot();
    

    Run this once, then set the environment variable:

    AGENT_BROWSER_SNAPSHOT_ID=snap_xxxxxxxxxxxx
    

    A helper script is available in the demo app:

    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:

    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:

    // 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 });
    }
    
    // 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.

    Reproducido de vercel-labs/agent-browser bajo licencia Apache-2.0. Leer esta página en markdown.

    Archivos

    1 archivo en el paquete. Solo se lee SKILL.md al activarse — las referencias se cargan si el skill decide que las necesita.

    Antes de instalar

    Requiere instalar @agent-browser/sandbox y @vercel/sandbox, y opcionalmente configurar AGENT_BROWSER_SNAPSHOT_ID, VERCEL_TOKEN, VERCEL_TEAM_ID y VERCEL_PROJECT_ID.

    Necesita en el PATH:npxpnpm

    Detalles

    Categoría
    Automatización
    Licencia
    Apache-2.0
    Recursos incluidos
    Solo SKILL.md
    Código fuente
    Ver SKILL.md

    Más de vercel-labs/agent-browser

    Este repo incluye 8 skills. Si instalas uno, normalmente ya tienes los demás.

    Core

    40.5k

    Guía central de uso de agent-browser: snapshots con refs, navegación, interacción con elementos, extracción de datos, capturas, pestañas, formularios, auth, esperas y sesiones paralelas.

    Costo de contexto al activarse
    7.4k tok
    Tamaño del paquete
    14 archivos
    Última actualización
    hace 3 días
    Oficialherramientas desarrollo

    CLI de automatización de navegador para agentes de IA: navega, rellena formularios, hace clic, captura pantallas, extrae datos, prueba apps y automatiza Electron o Slack.

    Costo de contexto al activarse
    841 tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 26 días
    Oficialtesting qa

    Reverse-engineerea la API interna de un sitio grabando el tráfico del navegador en un HAR, y genera un cliente o CLI standalone que llama a los endpoints sin necesitar navegador después.

    Costo de contexto al activarse
    1.3k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 26 días
    Oficialautomatizacion

    Automatiza apps de escritorio Electron (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) usando agent-browser vía Chrome DevTools Protocol.

    Costo de contexto al activarse
    1.7k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 4 meses
    Oficialherramientas desarrollo

    Dogfood

    40.5k

    Explora y prueba sistemáticamente una aplicación web para encontrar bugs y problemas de UX, generando un reporte con capturas paso a paso, videos de reproducción y pasos detallados por cada hallazgo.

    Costo de contexto al activarse
    2.7k tok
    Tamaño del paquete
    3 archivos
    Última actualización
    hace 4 meses
    Oficialtesting qa

    Ejecuta agent-browser en navegadores en la nube de AWS Bedrock AgentCore; úsalo para automatización de navegador respaldada por infraestructura AWS con credenciales AWS.

    Costo de contexto al activarse
    1k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 4 meses
    Oficialdevops infraestructura

    Skills relacionados

    Úsalo cuando enfrentes 2 o más tareas independientes que puedan trabajarse sin estado compartido ni dependencias secuenciales.

    Costo de contexto al activarse
    1.5k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    el mes pasado
    automatizacion

    Úsalo al ejecutar planes de implementación con tareas independientes dentro de la sesión actual.

    Costo de contexto al activarse
    8.1k tok
    Tamaño del paquete
    7 archivos
    Última actualización
    anteayer
    automatizacion

    Interrógame sobre las specs de los workflows que quiero construir, dentro de este workspace.

    Costo de contexto al activarse
    640 tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 16 días
    automatizacion