The Problem

AI agents need to interact with web pages, but browser automation tools are built for humans or require embedding a library. Existing solutions like Playwright or Puppeteer are heavyweight, require writing code in a specific language, and don't expose a clean command-line interface that an LLM can drive step-by-step. The result is that building agents that browse the web means writing custom integration code for each agent framework.

What This Does

agent-browser is a headless browser automation CLI designed for AI agents. It exposes a command-per-action interface — open, click, fill, snapshot — that an agent can call sequentially. The Rust CLI in cli/src/main.rs handles command parsing and dispatch, with a Node.js fallback in src/ for environments without Rust. The snapshot command produces an accessibility tree with element refs (@e1, @e2), which is the agent-friendly way to locate elements without CSS selectors.

The repo also includes a daemon mode (src/daemon.ts) and a streaming server (src/stream-server.ts) for persistent connections, plus a full documentation site under docs/ built with Next.js. The skills/agent-browser/SKILL.md file is a skill definition for agent frameworks that support the "skills" pattern.

How To Use It

Setup: Install via npm, or build from source. The repo uses pnpm (see package.json and pnpm-lock.yaml), and the native Rust build requires a Rust toolchain (cli/Cargo.toml).

npm install -g agent-browser agent-browser install # Download Chromium

Running it: The CLI is the entry point. Core commands from the README:

agent-browser open example.com agent-browser snapshot # Get accessibility tree with refs agent-browser click @e2 # Click by ref from snapshot agent-browser fill @e3 "test@example.com" # Fill by ref agent-browser screenshot page.png agent-browser close

Configuration: No environment variables are required. The agent-browser install command handles Chromium download, and --with-deps installs Linux system dependencies.

Real-World Use

A customer-support agent that needs to check order status:

agent-browser open https://shop.example.com/orders agent-browser fill "#email" "customer@example.com" agent-browser fill "#password" "secret" agent-browser click "#login" agent-browser snapshot Agent reads the snapshot, finds the order status element by ref agent-browser get text @e7 agent-browser close

The agent can loop: snapshot → parse the tree → act on a ref → snapshot again. This works well with LLM agents that process text output.

Code Health & Issues

Med - Dual implementation drift risk: The Rust CLI (cli/src/) and TypeScript fallback (src/) duplicate logic. They can diverge in behavior. Tests exist (src/actions.test.ts, src/browser.test.ts, src/protocol.test.ts) but only cover the TypeScript side, not the Rust CLI. Low - Untested Rust CLI: cli/src/ has no test files. The core command parsing and browser connection logic in cli/src/commands.rs and cli/src/connection.rs is untested. Low - Postinstall script complexity: scripts/postinstall.js and scripts/copy-native.js handle binary copying. This is a common failure point on exotic platforms, and the fallback behavior isn't documented. Low - CI coverage unknown: .github/workflows/ci.yml exists, but the analysis doesn't show what it covers. The test/serverless.test.ts file suggests some serverless-specific testing.

The repo is reasonably clean: license present, lockfiles committed, CI configured, husky pre-commit hook in place.

The Bottom Line

This is a well-designed tool for a specific niche: giving AI agents a simple, stateless CLI for browser automation. The ref-based snapshot approach is genuinely better for LLM consumption than raw selectors. The dual Rust/TypeScript implementation adds maintenance overhead, but the npm distribution makes it easy to adopt. Worth trying if you're building agent workflows that need web interaction and want to avoid embedding Playwright directly.