Files
wehub-resource-sync cb15c5e0d8
Release / Check for new version (push) Has been cancelled
Release / Build macOS ARM64 (push) Has been cancelled
Release / Build macOS x64 (push) Has been cancelled
Release / Build Linux ARM64 (push) Has been cancelled
Release / Build Linux musl ARM64 (push) Has been cancelled
Release / Build Linux musl x64 (push) Has been cancelled
Release / Build Linux x64 (push) Has been cancelled
Release / Build Windows x64 (push) Has been cancelled
Release / Publish to npm (push) Has been cancelled
Release / Publish sandbox package to npm (push) Has been cancelled
Release / Create GitHub Release (push) Has been cancelled
CI / Rust (windows-latest - x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Native E2E Tests (push) Has been cancelled
CI / Windows Integration Test (push) Has been cancelled
CI / Global Install (macos-latest) (push) Has been cancelled
CI / Global Install (ubuntu-latest) (push) Has been cancelled
CI / Version Sync Check (push) Has been cancelled
CI / Rust (push) Has been cancelled
CI / Dashboard (push) Has been cancelled
CI / Sandbox Package (push) Has been cancelled
CI / Rust (macos-latest - aarch64-apple-darwin) (push) Has been cancelled
CI / Rust (macos-latest - x86_64-apple-darwin) (push) Has been cancelled
CI / Global Install (windows-latest) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:58 +08:00

38 lines
1.4 KiB
Markdown

# agent-browser sandbox helpers
This example shows how to use `@agent-browser/sandbox` in two places:
- `eve/` is a scaffold-style Eve app with a sandbox-backed browser tool.
- `vercel/` uses `@vercel/sandbox` directly from a Node script.
The package installs `agent-browser` in the sandbox and runs commands there, not in the serverless function or app runtime.
## Eve
Run the Eve app from its own directory:
```bash
cd eve
pnpm install
vercel link --yes --scope <team-or-user> --project <project>
vercel env pull .env.local --yes
pnpm run dev
```
The app follows the project shape created by `eve init --channel-web-nextjs`. Its `agent/sandbox.ts` bootstrap installs Chromium system dependencies, `agent-browser`, and Chrome once into the sandbox template. The `browser_snapshot` tool opens a URL and returns an accessibility snapshot to the agent.
## Vercel Sandbox
Run the direct Vercel example from this directory:
```bash
pnpm install
vercel link --yes --scope <team-or-user> --project <project>
vercel env pull .env.local --yes
node vercel/snapshot-url.mjs https://example.com
```
The script loads `.env.local` when it is present, so local runs can use the OIDC token pulled by the Vercel CLI. On Vercel, the OIDC token is provided by the runtime.
For production, create and reuse a Vercel Sandbox snapshot so fresh requests do not reinstall system dependencies and Chrome.