Skip to main content
Get up and running with Agent Browser quickly. This guide walks you through the core workflow: installing, navigating to a page, taking a snapshot, and interacting with elements using refs.

Prerequisites

  • Node.js 18+ installed
  • Basic command line knowledge

Install and Setup

1

Install Agent Browser

Install globally for best performance:
2

Download Chromium

Agent Browser needs Chromium to run:
On Linux, you may need system dependencies:
3

Verify Installation

Test that everything works:
You should see the browser launch and navigate to example.com.

Your First Automation

Let’s automate a simple form fill workflow using the snapshot-ref pattern.
1

Navigate to a Page

Open a page with a form:
The browser will launch (headless by default) and navigate to the URL.
2

Take a Snapshot

Get the accessibility tree with element refs:
The -i flag shows only interactive elements (buttons, inputs, links). Output:
Each element gets a unique @e{N} ref that you can use to interact with it.
3

Fill the Form

Use refs to fill inputs and click buttons:
Refs are deterministic - @e1 always refers to the same element from the snapshot.
4

Get Results

Wait for navigation and check the result:
This shows the current URL and the new page structure.
5

Clean Up

Close the browser when done:

Alternative Selector Methods

You can also use traditional selectors alongside refs:
Refs are recommended for AI agents because they’re deterministic and don’t require DOM knowledge. CSS selectors are useful when you know the page structure.

Command Chaining

Chain multiple commands for efficiency:
The browser daemon persists between commands, so chaining is fast and safe.

JSON Output for AI Agents

Use --json for machine-readable output:
Returns structured JSON with the accessibility tree and refs:

Sessions for Parallel Browsers

Run multiple isolated browser instances:
Each session has its own browser, cookies, and state.

Headed Mode for Debugging

See what the browser is doing:
The browser window will be visible instead of headless.

Common Patterns

Wait for Elements

Get Information

Screenshots

Annotated Screenshots

For multimodal AI models that can see images:
This overlays numbered labels on interactive elements in the screenshot. The labels correspond to refs ([1] = @e1, [2] = @e2), so you can use the same refs after viewing the annotated screenshot.

Next Steps

Core Concepts

Learn about the Rust CLI + Node.js daemon architecture

All Commands

Browse the complete command reference

Security Features

Auth vault, domain allowlist, action policies

AI Agent Integration

Use with Claude Code, Cursor, and other AI assistants