vercel-sandbox
Skill này làm gì
Skill này chỉ cách chạy agent-browser và Chrome trên các máy đám mây tạm thời của Vercel. Nó dành cho lập trình viên thêm tính năng trình duyệt vào các ứng dụng chạy trên Vercel.
Khi nào nên dùng
- ✓Khi ứng dụng Vercel của bạn cần chụp ảnh màn hình các trang web.
- ✓Khi bạn cần một trình duyệt chạy trong môi trường biệt lập, tạm thời.
- ✓Khi bạn cần các phiên trình duyệt tồn tại qua nhiều lệnh.
Liên kết skill
https://github.com/vercel-labs/agent-browser/blob/main/skill-data/vercel-sandbox/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thêm một tính năng vào ứng dụng Next.js của tôi để chụp ảnh màn hình bất kỳ URL nào người dùng nhập.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Ứng dụng khởi động một máy sandbox nhỏ, cài những gì Chromium cần, chạy các lệnh trình duyệt ở đó, rồi tắt máy sau đó.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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>,
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():
import { startAgentBrowserMcp, withAgentBrowserSandbox } from "@agent-browser/sandbox/vercel";
const snapshot = await withAgentBrowserSandbox(async (sandbox) => {
co
Câu hỏi thường gặp
Những framework nào hoạt động với nó?
Skill nói nó hoạt động với mọi framework triển khai trên Vercel, như Next.js, SvelteKit, Nuxt, Remix và Astro.
Cần cài đặt những gì?
Skill liệt kê hai gói cần thêm vào dự án: helper sandbox của agent-browser và gói Vercel Sandbox.
Khởi động có nhanh hơn được không?
Skill nhắc đến các snapshot sandbox có thể tăng tốc khởi động.
Chi tiết
Mô tả gốc của tác giả
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.
Độ phổ biến
- Sao GitHub
- 45k
- Vị trí xếp hạng
- #6362
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
technical-writer
45kDạy agent của bạn viết và sửa tài liệu cho lập trình viên, như hướng dẫn, tham chiếu API và trang xử lý sự cố, rõ ràng và chính xác.
agentcore
45kCho agent của bạn chạy tự động hóa trình duyệt trên đám mây AgentCore của AWS Bedrock, dùng đăng nhập AWS sẵn có và các lệnh giống Chrome cục bộ.
core
45kDạy agent của bạn điều khiển trình duyệt web bằng snapshot và tham chiếu phần tử, để mở trang, nhấp, điền biểu mẫu và đọc nội dung.
derive-client
45kDạy agent của bạn ghi lại lưu lượng mạng của một trang web một lần, rồi xây một client độc lập gọi API nội bộ của trang mà không cần trình duyệt.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.