docs/src/app/providers/remote-agent-browser/page.mdx
Remote Agent Browser runs agent-browser inside an isolated Vercel Sandbox. Use it when a TypeScript application needs to provision a browser on demand without managing a local Chrome process.
Remote Agent Browser is a library rather than an agent-browser -p provider. Import it in your application and use the returned client to run agent-browser commands.
pnpm add remote-agent-browser
Authentication is automatic on Vercel through VERCEL_OIDC_TOKEN. For local development, link a Vercel project and pull its environment:
vercel link
vercel env pull .env.local
import { AgentBrowser } from "remote-agent-browser";
const browser = await AgentBrowser.create();
try {
await browser.exec("open", {
args: ["https://example.com"],
});
const snapshot = await browser.exec("snapshot");
console.log(snapshot.stdout);
} finally {
await browser.close();
}
Commands issued through the same client share the same page, cookies, tabs, and element references. Always close disposable clients when the work is complete.
Use a stable ID when browser identity needs to survive process boundaries:
const browser = AgentBrowser.session({
id: `chat:${chatId}`,
});
const stopKeepalive = browser.keepalive();
try {
await browser.exec("open", {
args: ["https://example.com"],
});
} finally {
stopKeepalive();
}
The first command finds or creates the named Sandbox. A later process using the same ID can attach to it. If an expired Sandbox resumes, Chromium starts fresh and in-memory page state is reset.
The default image is remote-agent-browser:latest. Pass a Vercel Container Registry repository, tag, digest, or fully qualified reference to use a custom image:
const browser = await AgentBrowser.create({
image: "vcr.vercel.com/my-team/my-project/my-browser:v1",
});
You can also set REMOTE_AGENT_BROWSER_IMAGE to configure the image for every client.
See the Remote Agent Browser repository for file transfer, proxy configuration, typed JSON output, keepalive, and stable-session examples.