# agent-browser

> A command-line tool that lets AI agents drive a Chrome browser

- Repository: https://github.com/vercel-labs/agent-browser
- Category: Browser & computer use
- Stars: 44,445 · Forks: 3,042 · Language: Rust · License: Apache-2.0
- Experience: Some experience
- Page: https://ir.adyog.com/repos/vercel-labs/agent-browser/

Agents often need to use websites: log in, fill a form, read a page, check how something looks. agent-browser gives them a simple set of shell commands for that, so any agent that can run a terminal command can control Chrome.

The usual loop is short. You open a URL, then run snapshot to get the page's accessibility tree, where each element has a ref such as @e2. The agent then clicks, fills or reads text using those refs. It also accepts ordinary CSS selectors and semantic finders like role, label and text.

It is a native Rust binary installed through npm, Homebrew or Cargo. The README says the daemon does not need Playwright or Node.js, and that it detects existing Chrome, Brave, Playwright and Puppeteer installs. It also has a read command that fetches pages as agent-friendly text without launching Chrome, and experimental WebMCP support.

## What it does

- **Snapshot and ref workflow**: The snapshot command prints the accessibility tree with element refs. Commands like click, fill and get text can then target those refs.
- **Many ways to target elements**: Besides refs, you can use CSS selectors or find elements by ARIA role, text, label, placeholder, alt text, title or test id.
- **Token-aware screenshots**: Screenshots can be annotated with numbered labels. The --if-changed flag skips images that have not changed, which saves tokens.
- **Read pages without a browser**: The read command fetches a URL as markdown or extracted text and can look up llms.txt files. Without a URL it reads the active tab's rendered page.
- **Guards for clicks and page data**: Clicks fail early if a banner or modal covers the target. Page-provided WebMCP data is labelled as untrusted, and domain filters and output limits are available.

## What you could build

- Let a coding agent open a site, fill in a form and confirm the result with a screenshot.
- Scrape the text of a page or docs site into markdown for an agent to read.
- Script end-to-end checks of a web app using refs, selectors or ARIA roles.
- Connect to an already running browser over CDP to inspect or drive it.
- Call tools that a web page exposes through experimental WebMCP.

## Who it's for

Developers building or using AI agents that need to operate websites; you should be comfortable with a terminal and basic web concepts like selectors.

## Get started

Install the CLI globally with npm, then run the install command once to download Chrome. After that, open a page, take a snapshot and act on elements by their refs.

```
npm install -g agent-browser
```
```
agent-browser install
```
```
agent-browser open example.com
```

Tags: browser-automation, cli, ai-agents, rust, chrome
