e1, e2, e3), AI-friendly errors, and self-healing connections.
Installation
Quick Start
Connection Modes
BrowserToolkit supports three connection modes, selected by theBrowserConfig you pass in.
Fresh Chrome (Default)
Launches a new ephemeral Chrome instance. Cookies and storage are discarded when the toolkit shuts down.Persistent Profile
Launch Chrome with a persistent user data directory. Cookies, localStorage, and logged-in sessions survive between runs.CDP Attach
Attach to an already-running Chrome instance via its remote debugging port. No new browser window is opened — the agent controls your existing browser.BrowserConfig Reference
str
WebSocket or HTTP URL of an existing Chrome CDP endpoint. When set, no new browser is launched.
bool
default:"false"
Run Chrome without a visible window.
str
Path to a Chrome user data directory for session persistence.
bool
default:"true"
Enable anti-detection flags (
--disable-blink-features=AutomationControlled).bool
default:"false"
Disable Chrome sandbox. Required in Docker/CI environments.
str
Proxy server in
"host:port" or "user:pass@host:port" format.str
Override the browser’s User-Agent string.
str
default:"en-US"
Browser locale code, e.g.
"en-US", "fr", "zh-CN".str
Browser timezone override, e.g.
"America/New_York".int
default:"1280"
Browser viewport width in pixels.
int
default:"720"
Browser viewport height in pixels.
float
default:"30.0"
Default per-operation timeout in seconds.
str
Path to Chrome/Brave/Edge binary. Auto-detected if not set.
tuple[str, ...]
Additional Chrome CLI flags.
Element Refs — The Key Innovation
Agents interact with semantic element refs instead of brittle CSS selectors. After callingbrowser_snapshot(), every interactive element gets a ref like e1, e2, e3:
browser_click("button.submit") is also valid. The ref system auto-detects which you’re using.
Tools Reference
All 55 tools are grouped by category below. Every tool name is prefixed withbrowser_.
Navigation (4 tools)
Page State (7 tools)
Perception (2 tools)
Interaction (15 tools)
Scrolling (3 tools)
Waiting (4 tools)
DOM Manipulation (2 tools)
Forms & Checkboxes (3 tools)
Cookies (3 tools)
Storage (2 tools)
Tabs (4 tools)
Output (1 tool)
Dialogs (1 tool)
Browser State (1 tool)
Diagnostics (3 tools)
Usage with Agent
The toolkit follows theAsyncLifecycleToolkit protocol. Use async with for automatic startup and shutdown: