Add guides/browser-agent-in-sandbox: a browser-research agent in a Vercel Sandbox#1524
Add guides/browser-agent-in-sandbox: a browser-research agent in a Vercel Sandbox#1524shrey150 wants to merge 4 commits into
Conversation
…rcel Sandbox Signed-off-by: Shrey Pandya <shrey@browserbase.com>
|
@shrey150 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Signed-off-by: Shrey Pandya <shrey@browserbase.com>
… CLI discovery Update the agent's system prompt to have it learn the browse CLI by running `browse skills show` first -- the CLI's bundled usage guide -- keeping `browse --help` as a supplementary reference. `browse skills show` ships in the next browse release; the runtime-install path pulls browse@latest and the VCR image path tracks ghcr.io/browserbase/browse, so no version pin is needed. Signed-off-by: Shrey Pandya <shrey@browserbase.com>
|
Updated: the agent's system prompt now points it at |
…nable - System prompt is now built fresh per request (buildSystemPrompt()): it states the environment fact (sandbox microVM, no local browser, sessions are remote and env-configured — never pass --local), injects today's date at request time instead of letting the model guess, and instructs the agent to stop navigating and give its best final answer when nearing the step limit. - Add a 'pnpm smoke' script running tsx with --conditions=import: this package is CJS-scoped and bash-tool is ESM-only (import condition only), so the documented plain 'tsx scripts/smoke.ts' could not resolve it. Sync the smoke.ts usage comment. - Sync README with the new prompt behavior. Signed-off-by: Shrey Pandya <shrey@browserbase.com>
|
browse@0.9.5 is now released (npm + Verified against the released artifacts: the route's default runtime-install path ( One fix surfaced by this pass: |
What
Adds
guides/browser-agent-in-sandbox— a full-stack Next.js app where an autonomous browser-research agent drives thebrowseCLI inside a Vercel Sandbox and streams its steps to the UI live: enter a prompt, watch eachbrowsestep stream in, get a final comparison table.Demo: browser-agent-in-sandbox.vercel.app
How it works
/api/chatroute: it provisions a sandbox, builds abashtool withbash-toolbound to that sandbox, and runs the AI SDK'sstreamTextwithstopWhen: stepCountIs(40). The model navigates the web by emittingbrowsecommands that execute inside the microVM.browseCLI drives a real browser on Browserbase — the browser never runs in the sandbox, only the CLI does, so the microVM stays cheap and the browser stays fully managed.anthropic/claude-sonnet-5resolves through the default Gateway provider inai@6, authenticated by the deployment'sVERCEL_OIDC_TOKEN. The same Vercel auth powers both the Sandbox and the model — there is no separate Anthropic key. The only secret isBROWSERBASE_API_KEY.useChatfrom@ai-sdk/reactrenders eachbrowsetool call (running/done/error) as it happens, and the final answer as Markdown.buildSystemPrompt()): it points the model atbrowse skills show(the CLI's bundled usage guide, shipped inbrowse≥ 0.9.5) to learn the CLI itself, states the environment fact (sandbox microVM, no local browser, sessions remote and env-configured — never pass--local), injects today's date at request time so the model never guesses a date, and instructs the agent to give its best final answer from what it has gathered when nearing the step limit.Sandbox image (dual-mode)
The route runs in two modes:
Dockerfilebakesbrowseinto a sandbox image pushed to the project's Vercel Container Registry. SetBROWSE_VCR_IMAGEand the route boots from it, skipping the per-request install.BROWSE_VCR_IMAGEis unset, the route bootsnode24and runsnpm install -g browseper request.A one-click Deploy with Vercel button and full setup/build instructions are in the README. A headless smoke harness (
pnpm smoke,scripts/smoke.ts) exercises the samerunBrowserAgentpath as/api/chatagainst real cloud.E2E Test Matrix
Run against released artifacts (
browse0.9.5, published to npm andghcr.io/browserbase/browse:latest), executing the example as committed on this branch (runtime-install path, default Amazon task, real Vercel Sandbox + AI Gateway + Browserbase).docker run --rm ghcr.io/browserbase/browse browse --version,browse skills show,browse --helpbrowse/0.9.5;skills showprints the bundled skill;--helpleads with the "Start here (for AI agents): browse skills show" header.Dockerfile/VCR path now serves 0.9.5 with the discovery surface the prompt depends on.Sandbox.create({ runtime: 'node24' })+npm install -g browse@latest, thenbrowse --version,browse skills show | head -5,browse --help | head -8in-sandboxbrowse/0.9.5 linux-x64 node-v24; skill frontmatter printed; agent-facing help header present.BROWSE_VCR_IMAGE) install path delivers released 0.9.5 inside a real Vercel Sandbox.pnpm smoke(full agent run through the samerunBrowserAgentas/api/chat; default Amazon task; model via AI Gateway OIDC)browse skills show. Thenbrowse open "https://www.amazon.com/s?k=mechanical+keyboard" --remote --session <name>,browse snapshot, extraction steps, and the agent's ownbrowse stop --session <name>— 10 bash calls, well under the 40-step cap, ~120s wall-clock, exit 0. Printed===== FINAL ANSWER =====with a 5-row comparison table (title, price, star rating, # of ratings, canonicalamazon.com/dp/<ASIN>URL per row), sponsored placements excluded.browse skills showfirst, never passes--local, keyless model via Gateway, complete correct-format answer.pnpm smokescript: plaintsx scripts/smoke.tsERR_PACKAGE_PATH_NOT_EXPORTED: No "exports" main defined in bash-tool/package.json— this package is CJS-scoped andbash-tool@1.3.17is ESM-only (importcondition only), so the previously documented invocation cannot resolve it (the Next.js app itself is unaffected — its bundler uses theimportcondition).smokescript (tsx --conditions=import) fixes; the passing run above is the proof.pnpm type-check(tsc--noEmit)buildSystemPrompt()refactor.status=RUNNINGafter the run[]onFinish.curl -N -X POST <demo>/api/chat, VCR image readiness probe, twovercel deploy --prodbuildsbrowsetool calls + final comparison table end-to-end from the deployment; VCR image booted withbrowseon PATH; production builds clean.Dockerfilepicks up 0.9.5, as shown by the registry row.Supersedes #1517 — reworked from
solutions/into a full-stack deployable guide underguides/(where the Sandbox examples live), with a live Demo, a Deploy button, and a VCR template image.🤖 Generated with Claude Code