vercel-sandbox
できること
このスキルは、一時的なVercelのクラウドマシンの中で、agent-browserとChromeを動かす方法を示します。Vercelでホストされるアプリにブラウザ機能を組み込む開発者向けです。
使う場面
- ✓Vercelのアプリで、ウェブページのスクリーンショットを撮る必要があるとき。
- ✓隔離された一時的な環境で動くブラウザがほしいとき。
- ✓複数のコマンドにわたって、ブラウザのセッションを保つ必要があるとき。
スキルのリンク
https://github.com/vercel-labs/agent-browser/blob/main/skill-data/vercel-sandbox/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“Next.jsアプリに、ユーザーが入力したURLのスクリーンショットを撮る機能を追加してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
アプリは小さなサンドボックスのマシンを起動し、Chromiumに必要なものをインストールして、そこでブラウザのコマンドを実行します。そのあと、マシンを停止します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
よくある質問
どのフレームワークで動きますか?
スキルによると、Next.js、SvelteKit、Nuxt、Remix、Astroなど、Vercelにデプロイされるどのフレームワークでも動きます。
何をインストールする必要がありますか?
スキルは、プロジェクトに追加する二つのパッケージを挙げています。agent-browserのサンドボックス用ヘルパーと、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.
人気
- GitHubのスター
- 45k
- ランキング
- #6362
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
technical-writer
45kガイド、APIリファレンス、トラブルシューティングのページなど、開発者向けのドキュメントを、明確な構成と正確な例で書いたり編集したりするようエージェントに教えます。
agentcore
45k既存のAWSサインインを使って、AWS Bedrock AgentCoreのクラウドブラウザでブラウザ自動化を実行します。コマンドはローカルのChromeと同じです。
core
45kスナップショットと要素の参照を使ってウェブブラウザを操作する方法を教えます。ページを開き、クリックし、フォームに入力し、内容を読めるようにします。
derive-client
45kウェブサイトのネットワーク通信を一度記録し、ブラウザなしで内部APIを呼び出す独立したクライアントを作る方法を教えます。
似ているスキル
openclaw-update
394k既存のOpenClaw Gatewayを更新するようエージェントを支援します。インストール方法に合った更新方法を選び、セッションを動かし続けます。
diagnose-gateway
394k設定、チャンネル、ポートを確認して、OpenClaw Gatewayが失敗している理由を、何も変更せずに突き止めるようエージェントを支援します。
crabbox-apps
394k一時的なクラウドマシン上でアプリを開いて実行し、そのビューをチャットのサイドパネルに表示するようエージェントを支援します。