agent-browser
Browser automation CLI for AI agents. Fast native Rust CLI.
Installation
Global Installation (recommended)
Installs the native Rust binary:
npm install -g agent-browser
agent-browser install # Download Chrome from Chrome for Testing (first time only)
Project Installation (local dependency)
For projects that want to pin the version in package.json:
npm install agent-browser
agent-browser install
Then use via package.json scripts or by invoking agent-browser directly.
Homebrew (macOS)
brew install agent-browser
agent-browser install # Download Chrome from Chrome for Testing (first time only)
Cargo (Rust)
cargo install agent-browser
agent-browser install # Download Chrome from Chrome for Testing (first time only)
From Source
Requires Node.js 24+, pnpm 11+, and Rust.
git clone https://github.com/vercel-labs/agent-browser
cd agent-browser
pnpm install
pnpm build
pnpm build:native # Requires Rust (https://rustup.rs)
pnpm link --global # Makes agent-browser available globally
agent-browser install
Linux Dependencies
On Linux, install system dependencies:
agent-browser install --with-deps
This exits nonzero if the package manager cannot install every required browser library.
Updating
Upgrade to the latest version:
agent-browser upgrade
Detects your installation method (npm, Homebrew, or Cargo) and runs the appropriate update command automatically.
Requirements
- Chrome - Run
agent-browser install to download Chrome from Chrome for Testing (Google's official automation channel). Existing Chrome, Brave, Playwright, and Puppeteer installations are detected automatically. No Playwright or Node.js required for the daemon.
- Node.js 24+ and pnpm 11+ - Only needed when building from source.
- Rust - Only needed when building from source (see From Source above).
Quick Start
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 "[email protected]" # Fill by ref
agent-browser get text @e1 # Get text by ref
agent-browser screenshot page.png
agent-browser close
Clicks fail early when another element covers the target's click point, for example a consent banner or modal. Dismiss or interact with the reported covering element, then take a fresh snapshot before retrying the original ref.
Headless Chromium screenshots hide native scrollbars for consistent image output. Pass --hide-scrollbars false when launching to keep native scrollbars visible.
Traditional Selectors (also supported)
agent-browser click "#submit"
agent-browser fill "#email" "[email protected]"
agent-browser find role button click --name "Submit"
Commands
Core Commands