Blog
Vercel agent-browser: how the browser CLI for AI agents works, and when to use it
Most browser automation was built for test scripts, not for language models reading the page one step at a time. Vercel's agent-browser flips that: snapshot, act on a ref, check, repeat. It's pulling 2.8 million npm downloads a week. Here's how it works and how to wire it into your agent.
If you've ever watched an AI agent try to use a website through a heavyweight test framework, you know the feeling. It's like watching someone read a book through a keyhole: screenshots too big for the context window, selectors that break, clicks that "succeed" on a cookie banner.
agent-browser, from Vercel Labs, was built for how agents actually think. It's an open-source Rust CLI that gives an agent a browser it can drive one small command at a time. And it's caught on fast: the repository, created in January 2026, had 54,691 stars on November 30, and the npm package logged 2,773,260 downloads in the week of November 23–29.
The core idea: snapshot, act, check
Instead of dumping HTML or a screenshot, snapshot returns the page as a compact accessibility tree, with a short ref for every interactive element:
agent-browser open example.com
agent-browser snapshot -i # interactive elements only
# - link "Learn more" [ref=e1]
agent-browser click @e1
agent-browser get url # verify what happened
agent-browser close
The agent acts on a ref, reads the page again, and repeats. The browser stays open between commands, so each step is one short shell call. That loop is cheap on tokens and easy for a model to reason about.
Two design choices we love:
- Clicks fail honestly. If the target is hidden, disabled, off-screen or covered (say, by a consent banner), the command fails instead of pretending it worked.
- Refs expire. After navigation or a DOM change, the agent must re-snapshot. That prevents the classic stale-element mistake.
Install
npm install -g agent-browser
agent-browser install # downloads Chrome for Testing (first time)
Or brew install agent-browser, or skip installing with npx agent-browser open example.com. On Linux, agent-browser install --with-deps also pulls the browser's system libraries. Native binaries ship for macOS, Linux (glibc and musl) and Windows.
Wire it into your agent
Three ways, from the README:
- Skill:
npx skills add vercel-labs/agent-browserinstalls a thin stub that tells the agent to loadagent-browser skills get core, so instructions always match your installed version. - AGENTS.md: add two lines telling the agent to use agent-browser and to run
agent-browser skills get corebefore first use. (New to these files? Here's how to write an AGENTS.md coding agents follow.) - MCP:
agent-browser mcpstarts an MCP server over stdio for any MCP client. Our MCP server list covers other browser options.
What else it can do
| Area | Commands |
|---|---|
| Read and navigate | open, read, snapshot, get, back, reload |
| Interact | click, fill, type, select, upload, drag, find |
| Capture | screenshot, pdf, record, download, diff |
| Debug and performance | console, errors, trace, profiler, vitals, a11y |
| Sessions and auth | session, state, auth, profiles, confirm, deny |
| Integrations | skills, mcp, webmcp, batch, plugin |
Under the hood, a background daemon controls the browser over the Chrome DevTools Protocol. Each --session gets its own browser, and an idle headless browser shuts down after an hour. You can attach to your running Chrome, choose Lightpanda, Obscura or Firefox engines, drive Mobile Safari in the iOS Simulator, or use cloud browsers from Browserbase, Browserless, Browser Use, Kernel or AWS AgentCore. It also runs inside Vercel Sandbox.
Safety: give it a fence
A browser agent can log in, submit forms and spend money. agent-browser ships an auth vault, domain allowlists, action policies and content boundaries, and confirm/deny commands for human-in-the-loop steps. Use them:
- Allowlist domains for each task.
- Keep credentials in the vault, never in prompts.
- Require confirmation for purchases, sends and deletes, which is your approval gate.
- Treat page content as untrusted: websites can contain instructions aimed at your agent.
When to choose agent-browser
- Choose it when a coding or research agent needs to check a deployed page, reproduce a UI bug, fill a form or read a site without an API.
- Choose an API or MCP server when one exists. It's faster and sturdier than any browser.
- Choose a full computer-use agent when the work spans desktop apps, not just the web. See can an AI agent use your computer?
For adoption data on other browser-agent frameworks, read our Browser Use vs Stagehand installs research, and for where browser agents fit overall, types of AI agents.
FAQ
What is Vercel agent-browser?
agent-browser is an open-source, Apache-2.0 browser automation CLI from Vercel Labs, written in Rust, that gives AI agents a browser they can drive one shell command at a time. Its snapshot command returns the page as a compact accessibility tree with refs such as @e1 that the agent can click or fill.
How do I install agent-browser?
Run npm install -g agent-browser, then agent-browser install to download Chrome for Testing the first time. Homebrew users can run brew install agent-browser. You can also try it without installing via npx agent-browser open example.com.
Does agent-browser work with Claude Code, Codex or Cursor?
Yes. Any agent that can run shell commands can use it. You can install its skill with npx skills add vercel-labs/agent-browser, add a line to AGENTS.md telling the agent to run agent-browser skills get core first, or run agent-browser mcp to expose it as an MCP server over stdio.
How is agent-browser different from Playwright?
Playwright is a general browser automation library for tests and scripts. agent-browser is designed for language-model agents: a persistent background browser, compact text snapshots with element refs, one short command per step, and clicks that fail loudly when an element is hidden or covered instead of reporting success.
Is agent-browser free?
Yes, it's open source under Apache-2.0. Costs come from the model driving it and, optionally, a cloud browser provider such as Browserbase, Browserless, Browser Use, Kernel or AgentCore.
How popular is agent-browser?
On November 30, 2026 the vercel-labs/agent-browser repository had 54,691 GitHub stars, and the agent-browser npm package logged 2,773,260 downloads in the week of November 23 to 29. The latest release was v0.45.0 on November 25.