vercel-labs/agent-browser

vercel-sandbox

把 Chrome 放进临时 microVM,用服务端代码管理会话

  • SKILL.md 已保存
  • 中文用法已整理
  • 安装与运行未实测
先判断是否解决你的问题

vercel-sandbox 是什么?

vercel-sandbox 通过 @agent-browser/sandbox 与 @vercel/sandbox,在临时Linux microVM中运行agent-browser和Chrome。它提供截图、快照、多步操作与MCP进程的封装,适合Vercel应用需要独立浏览器环境的任务。

中文说明由本站依据来源整理;英文原文保留在页面下方。

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 vercel-sandbox,然后按本页使用示例提供材料。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 vercel-sandbox

请在 Codex 的当前工作环境中安装并检查 vercel-sandbox 这个 Skill。

项目身份:vercel-labs/agent-browser / vercel-sandbox
来源:https://github.com/vercel-labs/agent-browser/blob/53384771fbafc261ba67608ac806dd5aa70b84f0/skill-data/vercel-sandbox/SKILL.md
已定位的源文件:skill-data/vercel-sandbox/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
准备输入,再按步骤执行

装好以后,具体怎么用?

准备哪些材料

  • 工程需对应的两个npm包和可用Vercel Sandbox身份;Vercel部署可使用OIDC,本地开发按真实token、team和project配置。

会得到什么

  • 云VM中真实浏览器任务的结果或截图,以及资源生命周期与错误记录。

实际使用顺序

  1. 安装对应依赖,在服务端使用 withAgentBrowserSandbox 包住任务,用 runAgentBrowserCommand 顺序打开页面、取快照与操作。
  2. 截图命令返回的是VM内文件路径,需要从sandbox回读文件或base64;没有路径时明确失败。多步表单使用与业务结果对应的等待条件,不只等固定时间。
  3. 重复运行时可用 createAgentBrowserSnapshot 建立含系统依赖、CLI与Chromium的VM镜像,并保存AGENT_BROWSER_SNAPSHOT_ID;不要把它与页面可访问性snapshot混淆。
  4. 单任务结束关闭浏览器并释放资源;同VM大量MCP调用可查startAgentBrowserMcp,该方式要求@vercel/sandbox 3.7及以上。
使用示例

从一个具体任务开始

本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。

安装并识别 Skill 后发送

复制一个具体任务

教学示例:请用 vercel-sandbox 在当前已授权Vercel项目设计一个服务端截图接口:接收允许列表内的预览URL,开浏览器后截图、回读文件并关闭会话。先核对SDK版本和认证方式,写实现与失败分支,不创建定时任务。
预期结果

预期区分VM文件和接口返回内容;身份或SDK条件不足时列出缺项。本站未创建云资源。

使用前先看这些限制

使用条件与边界

  • sandbox snapshot是VM镜像,不是网页元素树;两者解决启动成本与页面定位两个问题。
  • 源文件的启动耗时是其说明,不能写成本网站的实测性能承诺。
  • Cron仅是可选触发方式,不会自动提供数据存储、限速或业务通知。
针对这个 Skill 的疑问

常见问题

为什么截图结果只是路径?

文件在临时VM内,调用端需要通过sandbox读取后再返回。只把VM路径交给外部用户通常无法直接访问。

需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
中文使用说明
已针对下方源文件版本整理用途、用法和常见问题
安装与任务测试
本站未执行安装或任务测试
来源复核
本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料

skill-data/vercel-sandbox/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

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.

查看源文件章节 / Source sections
  • 原文:Browser Automation with Vercel Sandbox
  • 原文:Dependencies
  • 原文:Core Pattern
  • 原文:Screenshot
  • 原文:Accessibility Snapshot
  • 原文:Multi-Step Workflows
  • 原文:MCP Server over stdin
  • 原文:Sandbox Snapshots (Fast Startup)
  • 原文:Creating a sandbox snapshot
  • 原文:Authentication
  • 原文:Scheduled Workflows (Cron)
  • 原文:Environment Variables
  • 原文:Framework Examples
  • 示例 / Example
原文: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 }; }); } ```

文件 SHA256:60efbb6cf778f4fe4929788e9cc3780a9161c9a77c293b9ebbf735050d0650cd

仓库许可证记录:Apache-2.0;repository-license-recorded-scope-unverified,查看来源。

SKILL.md原文description · 2026-11-16T12:36:35.145Z

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.

查看历史简介来源

历史收录数据

来源仓库vercel-labs/agent-browser
Skill源路径skill-data/vercel-sandbox/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源