
agent-browser
Browser automation CLI with ref-based snapshots for AI agents
Replaces Browserbase, Browserless

Who it's for
agent-browser gives an AI agent the full power of a real browser through shell commands: navigate, click, fill forms, take screenshots, and read rendered page content. The ref-based snapshot format keeps context usage low enough to run extended sessions without hitting token limits.
Your agent only needs to fetch static HTML or JSON from APIs. For those workflows, a lightweight HTTP client is simpler and faster than spinning up a browser daemon.
Batch mode lets a CI job run a full browser workflow in a single agent-browser invocation, avoiding per-command process startup. Built-in screenshot diffing and annotated screenshots produce artifacts useful for visual regression checks without a separate testing framework.
You need cross-browser testing across Firefox, WebKit, and Chrome. agent-browser targets Chrome via CDP; Playwright is the better choice when multi-browser coverage is required.
The read command fetches agent-readable text from any URL and reads the rendered DOM of an active browser session for pages that require authentication or JavaScript rendering. Sessions carry auth state, so scraping behind a login is a first-class use case.
Your sources serve clean structured data such as RSS, sitemaps, or public REST APIs. agent-browser adds value when you need JavaScript rendering or browser authentication; otherwise a simpler HTTP client is sufficient.
WebMCP (experimental) exposes page-provided tools to the CLI and to connected AI agents. Pages that implement the protocol can surface typed tools with schemas that agent-browser discovers automatically and makes available for invocation, turning a web page into a tool server for an agent.
WebMCP is experimental and requires page-side implementation. If the pages you are working with do not implement WebMCP, this feature does not apply.
The problem
Browser automation for AI agents carries two costs that compound quickly. Full DOM dumps run 3,000-5,000 tokens per page, consuming context budget before the agent completes a single meaningful step. Spawning a fresh browser process for each command adds startup latency that accumulates across multi-step workflows. Managed cloud browser services avoid the infrastructure burden but introduce per-session pricing, off-premises data handling, and no path to local execution. Running Playwright or Puppeteer gives you more control but produces verbose JSON output designed for JavaScript code, not for LLMs issuing shell commands.
How it works
The snapshot command returns a compact accessibility tree where every interactive element carries a unique ref like @e1 or @e2. Clicking or filling by ref skips DOM re-querying and points at the exact element from the snapshot, which keeps agent steps deterministic across dynamic pages. Output runs 200-400 tokens per page versus 3,000-5,000 for a full DOM dump.
Commands cover navigation, form filling, keyboard input, drag and drop, file upload, screenshots, PDF export, JavaScript eval, clipboard, mouse control, tab and frame management, cookie and storage access, network interception, and debugging. AI agents can script complete multi-step workflows without Playwright or Puppeteer on the caller side.
A native Rust daemon manages Chrome via the Chrome DevTools Protocol and persists between commands. Process startup overhead is paid once per session, not per command. The daemon starts automatically, saves restore state by default, and exits after a configurable idle timeout. Headed browsers, Safari, and user-attached browsers are exempt from the timeout.
Multiple commands can run in a single CLI invocation, passed as quoted arguments or piped as JSON via stdin. Batch mode avoids per-command process startup for multi-step workflows. Pass --bail to halt on the first error, or let all commands run and inspect results.
Video recording, runtime WebSocket streaming, a profiler, and screenshot diffing are built into the CLI. The annotated screenshot flag adds numbered labels to elements. These tools let you trace agent decisions, compare page states across runs, and debug failed interactions without external tooling.
Sessions carry profiles, auth state, cookies, storage, and proxy configuration, supporting long-running agents that need to log in once and maintain state across pages. The --restore flag preserves session state between daemon restarts.
Features
- Ref-based accessibility tree snapshots
- 50+ CLI commands for full browser control
- Client-daemon architecture for fast repeat commands
- Batch command execution
- Built-in observability tools
- Stateful sessions with auth and proxy support
How to install
Install the native binary globally via npm, then run install to download Chrome from Chrome for Testing.
npm install -g agent-browser
agent-browser installRecommended for this setup
Strengths
- Apache-2.0 license with no managed service dependency: The binary is Apache-2.0 licensed and can run on a developer's laptop, a CI container, or a cloud VM wherever Chrome is available. Unlike Browserbase and Browserless, there is no per-session API pricing and no data leaving your environment. You install the binary and the browser stays local.
- Token-efficient output designed for LLM context budgets: The snapshot output format was designed specifically for AI context windows. Where a full DOM export costs 3,000-5,000 tokens, a snapshot costs 200-400. Over a multi-step agent workflow that difference compounds. Fewer tokens on browser state means more budget for reasoning, tool calls, and memory.
- Native Rust binaries, no Playwright runtime required: agent-browser ships as a native binary for macOS (ARM64, x64), Linux (ARM64, x64), and Windows (x64). The Chrome DevTools Protocol daemon is pure Rust with no Node.js runtime dependency after install. Playwright and Puppeteer are not required.
- Compatible with every major AI coding agent: Works with Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Google Gemini, and opencode out of the box. Any agent that can run shell commands can use agent-browser; no SDK or library integration is required.
Trade-offs
- Chrome required as a runtime dependency: Running agent-browser requires Chrome, downloaded via agent-browser install from Chrome for Testing on first run. Linux deployments may need system browser libraries installed separately via agent-browser install --with-deps, and this command exits with a non-zero code if the package manager cannot install every required library.
- High issue volume for a project under a year old: The repo launched in January 2026 and carries 719 open issues as of September 2026. Active community interest has driven fast feature growth, but the issue backlog also signals accumulating rough edges. Production deployments should pin a release version and test upgrades before rolling out.
- Parallel sessions require separate daemon instances: The daemon model is designed for one active browser session per machine. Agents that need many parallel browser sessions across different contexts must run multiple daemon instances on separate machines or containers, which requires infrastructure coordination that a managed cloud browser service handles automatically.
Tech stack
FAQ
Node.js is only required when building from source. The distributed npm package contains the native Rust binary; running npm install -g agent-browser installs the binary through npm but the runtime is pure Rust with no ongoing Node.js dependency. You can also install via Homebrew or Cargo without touching Node.js.
Yes. agent-browser install downloads Chrome from Chrome for Testing by default, but existing Chrome, Brave, Playwright, and Puppeteer installations are detected automatically. You do not need to download a separate browser if a supported one is already present.
Playwright and Puppeteer expose a JavaScript/TypeScript API that returns verbose DOM data and HTML, typically 3,000-5,000 tokens per page. agent-browser is a CLI designed for agents that issue shell commands: it returns a compact accessibility tree at 200-400 tokens per snapshot. For human-written test automation where a typed API is preferred, Playwright remains the standard choice.
Yes. agent-browser is Apache-2.0 licensed, which permits commercial use, modification, and redistribution. There are no usage fees, no API keys, and no managed service required. You run the binary on your own infrastructure.
Documented integrations include Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Google Gemini, and opencode. Any agent capable of running shell commands can use agent-browser, as the interface is entirely CLI-based with no SDK or library integration required.