agent-browser — for Claude Code agent-browser, enterprise-agent-development-lifecycle, community, for Claude Code, ide skills, npm i -g agent-browser, brew install agent-browser, cargo install agent-browser, agent-browser install, agent-browser upgrade

v1.0.0

Sobre este Skill

Cenario recomendado: Ideal for AI agents that need browser automation with agent-browser. Resumo localizado: Install via npm i -g agent-browser, brew install agent-browser, or cargo install agent-browser. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

Recursos

Browser Automation with agent-browser
Every browser automation follows this pattern:
Navigate : agent-browser open <url
Snapshot : agent-browser snapshot -i (get element refs like @e1, @e2)
Interact : Use refs to click, fill, select

# Core Topics

ncolesummers ncolesummers
[0]
[0]
Updated: 4/5/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reference-Only Page Review Score: 10/11

This page remains useful for teams, but Killer-Skills treats it as reference material instead of a primary organic landing page.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution Quality floor passed for review
Review Score
10/11
Quality Score
70
Canonical Locale
en
Detected Body Locale
en

Cenario recomendado: Ideal for AI agents that need browser automation with agent-browser. Resumo localizado: Install via npm i -g agent-browser, brew install agent-browser, or cargo install agent-browser. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

Por que usar essa habilidade

Recomendacao: agent-browser helps agents browser automation with agent-browser. Install via npm i -g agent-browser, brew install agent-browser, or cargo install agent-browser. This AI agent skill supports Claude Code

Melhor para

Cenario recomendado: Ideal for AI agents that need browser automation with agent-browser.

Casos de Uso Práticos for agent-browser

Caso de uso: Applying Browser Automation with agent-browser
Caso de uso: Applying Every browser automation follows this pattern:
Caso de uso: Applying Navigate : agent-browser open <url

! Segurança e Limitações

  • Limitacao: When automating a site that requires login, choose the approach that fits:
  • Limitacao: Requires repository-specific context from the skill documentation
  • Limitacao: Works best when the underlying tools and dependencies are already configured

Why this page is reference-only

  • - Current locale does not satisfy the locale-governance contract.

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

After The Review

Decide The Next Action Before You Keep Reading Repository Material

Killer-Skills should not stop at opening repository instructions. It should help you decide whether to install this skill, when to cross-check against trusted collections, and when to move into workflow rollout.

Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is agent-browser?

Cenario recomendado: Ideal for AI agents that need browser automation with agent-browser. Resumo localizado: Install via npm i -g agent-browser, brew install agent-browser, or cargo install agent-browser. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

How do I install agent-browser?

Run the command: npx killer-skills add ncolesummers/enterprise-agent-development-lifecycle/agent-browser. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for agent-browser?

Key use cases include: Caso de uso: Applying Browser Automation with agent-browser, Caso de uso: Applying Every browser automation follows this pattern:, Caso de uso: Applying Navigate : agent-browser open <url.

Which IDEs are compatible with agent-browser?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for agent-browser?

Limitacao: When automating a site that requires login, choose the approach that fits:. Limitacao: Requires repository-specific context from the skill documentation. Limitacao: Works best when the underlying tools and dependencies are already configured.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add ncolesummers/enterprise-agent-development-lifecycle/agent-browser. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use agent-browser immediately in the current project.

! Reference-Only Mode

This page remains useful for installation and reference, but Killer-Skills no longer treats it as a primary indexable landing page. Read the review above before relying on the upstream repository instructions.

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

agent-browser

Install via npm i -g agent-browser, brew install agent-browser, or cargo install agent-browser. This AI agent skill supports Claude Code, Cursor, and Windsurf

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

Browser Automation with agent-browser

The CLI uses Chrome/Chromium via CDP directly. Install via npm i -g agent-browser, brew install agent-browser, or cargo install agent-browser. Run agent-browser install to download Chrome. Run agent-browser upgrade to update to the latest version.

Core Workflow

Every browser automation follows this pattern:

  1. Navigate: agent-browser open <url>
  2. Snapshot: agent-browser snapshot -i (get element refs like @e1, @e2)
  3. Interact: Use refs to click, fill, select
  4. Re-snapshot: After navigation or DOM changes, get fresh refs
bash
1agent-browser open https://example.com/form 2agent-browser snapshot -i 3# Output: @e1 [input type="email"], @e2 [input type="password"], @e3 [button] "Submit" 4 5agent-browser fill @e1 "user@example.com" 6agent-browser fill @e2 "password123" 7agent-browser click @e3 8agent-browser wait --load networkidle 9agent-browser snapshot -i # Check result

Command Chaining

Commands can be chained with && in a single shell invocation. The browser persists between commands via a background daemon, so chaining is safe and more efficient than separate calls.

bash
1# Chain open + wait + snapshot in one call 2agent-browser open https://example.com && agent-browser wait --load networkidle && agent-browser snapshot -i 3 4# Chain multiple interactions 5agent-browser fill @e1 "user@example.com" && agent-browser fill @e2 "password123" && agent-browser click @e3 6 7# Navigate and capture 8agent-browser open https://example.com && agent-browser wait --load networkidle && agent-browser screenshot page.png

When to chain: Use && when you don't need to read the output of an intermediate command before proceeding (e.g., open + wait + screenshot). Run commands separately when you need to parse the output first (e.g., snapshot to discover refs, then interact using those refs).

Handling Authentication

When automating a site that requires login, choose the approach that fits:

Option 1: Import auth from the user's browser (fastest for one-off tasks)

bash
1# Connect to the user's running Chrome (they're already logged in) 2agent-browser --auto-connect state save ./auth.json 3# Use that auth state 4agent-browser --state ./auth.json open https://app.example.com/dashboard

State files contain session tokens in plaintext -- add to .gitignore and delete when no longer needed. Set AGENT_BROWSER_ENCRYPTION_KEY for encryption at rest.

Option 2: Persistent profile (simplest for recurring tasks)

bash
1# First run: login manually or via automation 2agent-browser --profile ~/.myapp open https://app.example.com/login 3# ... fill credentials, submit ... 4 5# All future runs: already authenticated 6agent-browser --profile ~/.myapp open https://app.example.com/dashboard

Option 3: Session name (auto-save/restore cookies + localStorage)

bash
1agent-browser --session-name myapp open https://app.example.com/login 2# ... login flow ... 3agent-browser close # State auto-saved 4 5# Next time: state auto-restored 6agent-browser --session-name myapp open https://app.example.com/dashboard

Option 4: Auth vault (credentials stored encrypted, login by name)

bash
1echo "$PASSWORD" | agent-browser auth save myapp --url https://app.example.com/login --username user --password-stdin 2agent-browser auth login myapp

auth login navigates with load and then waits for login form selectors to appear before filling/clicking, which is more reliable on delayed SPA login screens.

Option 5: State file (manual save/load)

bash
1# After logging in: 2agent-browser state save ./auth.json 3# In a future session: 4agent-browser state load ./auth.json 5agent-browser open https://app.example.com/dashboard

See references/authentication.md for OAuth, 2FA, cookie-based auth, and token refresh patterns.

Essential Commands

bash
1# Navigation 2agent-browser open <url> # Navigate (aliases: goto, navigate) 3agent-browser close # Close browser 4agent-browser close --all # Close all active sessions 5 6# Snapshot 7agent-browser snapshot -i # Interactive elements with refs (recommended) 8agent-browser snapshot -s "#selector" # Scope to CSS selector 9 10# Interaction (use @refs from snapshot) 11agent-browser click @e1 # Click element 12agent-browser click @e1 --new-tab # Click and open in new tab 13agent-browser fill @e2 "text" # Clear and type text 14agent-browser type @e2 "text" # Type without clearing 15agent-browser select @e1 "option" # Select dropdown option 16agent-browser check @e1 # Check checkbox 17agent-browser press Enter # Press key 18agent-browser keyboard type "text" # Type at current focus (no selector) 19agent-browser keyboard inserttext "text" # Insert without key events 20agent-browser scroll down 500 # Scroll page 21agent-browser scroll down 500 --selector "div.content" # Scroll within a specific container 22 23# Get information 24agent-browser get text @e1 # Get element text 25agent-browser get url # Get current URL 26agent-browser get title # Get page title 27agent-browser get cdp-url # Get CDP WebSocket URL 28 29# Wait 30agent-browser wait @e1 # Wait for element 31agent-browser wait --load networkidle # Wait for network idle 32agent-browser wait --url "**/page" # Wait for URL pattern 33agent-browser wait 2000 # Wait milliseconds 34agent-browser wait --text "Welcome" # Wait for text to appear (substring match) 35agent-browser wait --fn "!document.body.innerText.includes('Loading...')" # Wait for text to disappear 36agent-browser wait "#spinner" --state hidden # Wait for element to disappear 37 38# Downloads 39agent-browser download @e1 ./file.pdf # Click element to trigger download 40agent-browser wait --download ./output.zip # Wait for any download to complete 41agent-browser --download-path ./downloads open <url> # Set default download directory 42 43# Network 44agent-browser network requests # Inspect tracked requests 45agent-browser network requests --type xhr,fetch # Filter by resource type 46agent-browser network requests --method POST # Filter by HTTP method 47agent-browser network requests --status 2xx # Filter by status (200, 2xx, 400-499) 48agent-browser network request <requestId> # View full request/response detail 49agent-browser network route "**/api/*" --abort # Block matching requests 50agent-browser network har start # Start HAR recording 51agent-browser network har stop ./capture.har # Stop and save HAR file 52 53# Viewport & Device Emulation 54agent-browser set viewport 1920 1080 # Set viewport size (default: 1280x720) 55agent-browser set viewport 1920 1080 2 # 2x retina (same CSS size, higher res screenshots) 56agent-browser set device "iPhone 14" # Emulate device (viewport + user agent) 57 58# Capture 59agent-browser screenshot # Screenshot to temp dir 60agent-browser screenshot --full # Full page screenshot 61agent-browser screenshot --annotate # Annotated screenshot with numbered element labels 62agent-browser screenshot --screenshot-dir ./shots # Save to custom directory 63agent-browser screenshot --screenshot-format jpeg --screenshot-quality 80 64agent-browser pdf output.pdf # Save as PDF 65 66# Live preview / streaming 67agent-browser stream enable # Start runtime WebSocket streaming on an auto-selected port 68agent-browser stream enable --port 9223 # Bind a specific localhost port 69agent-browser stream status # Inspect enabled state, port, connection, and screencasting 70agent-browser stream disable # Stop runtime streaming and remove the .stream metadata file 71 72# Clipboard 73agent-browser clipboard read # Read text from clipboard 74agent-browser clipboard write "Hello, World!" # Write text to clipboard 75agent-browser clipboard copy # Copy current selection 76agent-browser clipboard paste # Paste from clipboard 77 78# Dialogs (alert, confirm, prompt, beforeunload) 79# By default, alert and beforeunload dialogs are auto-accepted so they never block the agent. 80# confirm and prompt dialogs still require explicit handling. 81# Use --no-auto-dialog to disable automatic handling. 82agent-browser dialog accept # Accept dialog 83agent-browser dialog accept "my input" # Accept prompt dialog with text 84agent-browser dialog dismiss # Dismiss/cancel dialog 85agent-browser dialog status # Check if a dialog is currently open 86 87# Diff (compare page states) 88agent-browser diff snapshot # Compare current vs last snapshot 89agent-browser diff snapshot --baseline before.txt # Compare current vs saved file 90agent-browser diff screenshot --baseline before.png # Visual pixel diff 91agent-browser diff url <url1> <url2> # Compare two pages 92agent-browser diff url <url1> <url2> --wait-until networkidle # Custom wait strategy 93agent-browser diff url <url1> <url2> --selector "#main" # Scope to element

Streaming

Every session automatically starts a WebSocket stream server on an OS-assigned port. Use agent-browser stream status to see the bound port and connection state. Use stream disable to tear it down, and stream enable --port <port> to re-enable on a specific port.

Batch Execution

Execute multiple commands in a single invocation by piping a JSON array of string arrays to batch. This avoids per-command process startup overhead when running multi-step workflows.

bash
1echo '[ 2 ["open", "https://example.com"], 3 ["snapshot", "-i"], 4 ["click", "@e1"], 5 ["screenshot", "result.png"] 6]' | agent-browser batch --json 7 8# Stop on first error 9agent-browser batch --bail < commands.json

Use batch when you have a known sequence of commands that don't depend on intermediate output. Use separate commands or && chaining when you need to parse output between steps (e.g., snapshot to discover refs, then interact).

Common Patterns

Form Submission

bash
1agent-browser open https://example.com/signup 2agent-browser snapshot -i 3agent-browser fill @e1 "Jane Doe" 4agent-browser fill @e2 "jane@example.com" 5agent-browser select @e3 "California" 6agent-browser check @e4 7agent-browser click @e5 8agent-browser wait --load networkidle
bash
1# Save credentials once (encrypted with AGENT_BROWSER_ENCRYPTION_KEY) 2# Recommended: pipe password via stdin to avoid shell history exposure 3echo "pass" | agent-browser auth save github --url https://github.com/login --username user --password-stdin 4 5# Login using saved profile (LLM never sees password) 6agent-browser auth login github 7 8# List/show/delete profiles 9agent-browser auth list 10agent-browser auth show github 11agent-browser auth delete github

auth login waits for username/password/submit selectors before interacting, with a timeout tied to the default action timeout.

Authentication with State Persistence

bash
1# Login once and save state 2agent-browser open https://app.example.com/login 3agent-browser snapshot -i 4agent-browser fill @e1 "$USERNAME" 5agent-browser fill @e2 "$PASSWORD" 6agent-browser click @e3 7agent-browser wait --url "**/dashboard" 8agent-browser state save auth.json 9 10# Reuse in future sessions 11agent-browser state load auth.json 12agent-browser open https://app.example.com/dashboard

Session Persistence

bash
1# Auto-save/restore cookies and localStorage across browser restarts 2agent-browser --session-name myapp open https://app.example.com/login 3# ... login flow ... 4agent-browser close # State auto-saved to ~/.agent-browser/sessions/ 5 6# Next time, state is auto-loaded 7agent-browser --session-name myapp open https://app.example.com/dashboard 8 9# Encrypt state at rest 10export AGENT_BROWSER_ENCRYPTION_KEY=$(openssl rand -hex 32) 11agent-browser --session-name secure open https://app.example.com 12 13# Manage saved states 14agent-browser state list 15agent-browser state show myapp-default.json 16agent-browser state clear myapp 17agent-browser state clean --older-than 7

Working with Iframes

Iframe content is automatically inlined in snapshots. Refs inside iframes carry frame context, so you can interact with them directly.

bash
1agent-browser open https://example.com/checkout 2agent-browser snapshot -i 3# @e1 [heading] "Checkout" 4# @e2 [Iframe] "payment-frame" 5# @e3 [input] "Card number" 6# @e4 [input] "Expiry" 7# @e5 [button] "Pay" 8 9# Interact directly — no frame switch needed 10agent-browser fill @e3 "4111111111111111" 11agent-browser fill @e4 "12/28" 12agent-browser click @e5 13 14# To scope a snapshot to one iframe: 15agent-browser frame @e2 16agent-browser snapshot -i # Only iframe content 17agent-browser frame main # Return to main frame

Data Extraction

bash
1agent-browser open https://example.com/products 2agent-browser snapshot -i 3agent-browser get text @e5 # Get specific element text 4agent-browser get text body > page.txt # Get all page text 5 6# JSON output for parsing 7agent-browser snapshot -i --json 8agent-browser get text @e1 --json

Parallel Sessions

bash
1agent-browser --session site1 open https://site-a.com 2agent-browser --session site2 open https://site-b.com 3 4agent-browser --session site1 snapshot -i 5agent-browser --session site2 snapshot -i 6 7agent-browser session list

Connect to Existing Chrome

bash
1# Auto-discover running Chrome with remote debugging enabled 2agent-browser --auto-connect open https://example.com 3agent-browser --auto-connect snapshot 4 5# Or with explicit CDP port 6agent-browser --cdp 9222 snapshot

Auto-connect discovers Chrome via DevToolsActivePort, common debugging ports (9222, 9229), and falls back to a direct WebSocket connection if HTTP-based CDP discovery fails.

Color Scheme (Dark Mode)

bash
1# Persistent dark mode via flag (applies to all pages and new tabs) 2agent-browser --color-scheme dark open https://example.com 3 4# Or via environment variable 5AGENT_BROWSER_COLOR_SCHEME=dark agent-browser open https://example.com 6 7# Or set during session (persists for subsequent commands) 8agent-browser set media dark

Viewport & Responsive Testing

bash
1# Set a custom viewport size (default is 1280x720) 2agent-browser set viewport 1920 1080 3agent-browser screenshot desktop.png 4 5# Test mobile-width layout 6agent-browser set viewport 375 812 7agent-browser screenshot mobile.png 8 9# Retina/HiDPI: same CSS layout at 2x pixel density 10# Screenshots stay at logical viewport size, but content renders at higher DPI 11agent-browser set viewport 1920 1080 2 12agent-browser screenshot retina.png 13 14# Device emulation (sets viewport + user agent in one step) 15agent-browser set device "iPhone 14" 16agent-browser screenshot device.png

The scale parameter (3rd argument) sets window.devicePixelRatio without changing CSS layout. Use it when testing retina rendering or capturing higher-resolution screenshots.

Visual Browser (Debugging)

bash
1agent-browser --headed open https://example.com 2agent-browser highlight @e1 # Highlight element 3agent-browser inspect # Open Chrome DevTools for the active page 4agent-browser record start demo.webm # Record session 5agent-browser profiler start # Start Chrome DevTools profiling 6agent-browser profiler stop trace.json # Stop and save profile (path optional)

Use AGENT_BROWSER_HEADED=1 to enable headed mode via environment variable. Browser extensions work in both headed and headless mode.

Local Files (PDFs, HTML)

bash
1# Open local files with file:// URLs 2agent-browser --allow-file-access open file:///path/to/document.pdf 3agent-browser --allow-file-access open file:///path/to/page.html 4agent-browser screenshot output.png

iOS Simulator (Mobile Safari)

bash
1# List available iOS simulators 2agent-browser device list 3 4# Launch Safari on a specific device 5agent-browser -p ios --device "iPhone 16 Pro" open https://example.com 6 7# Same workflow as desktop - snapshot, interact, re-snapshot 8agent-browser -p ios snapshot -i 9agent-browser -p ios tap @e1 # Tap (alias for click) 10agent-browser -p ios fill @e2 "text" 11agent-browser -p ios swipe up # Mobile-specific gesture 12 13# Take screenshot 14agent-browser -p ios screenshot mobile.png 15 16# Close session (shuts down simulator) 17agent-browser -p ios close

Requirements: macOS with Xcode, Appium (npm install -g appium && appium driver install xcuitest)

Real devices: Works with physical iOS devices if pre-configured. Use --device "<UDID>" where UDID is from xcrun xctrace list devices.

Security

All security features are opt-in. By default, agent-browser imposes no restrictions on navigation, actions, or output.

Enable --content-boundaries to wrap page-sourced output in markers that help LLMs distinguish tool output from untrusted page content:

bash
1export AGENT_BROWSER_CONTENT_BOUNDARIES=1 2agent-browser snapshot 3# Output: 4# --- AGENT_BROWSER_PAGE_CONTENT nonce=<hex> origin=https://example.com --- 5# [accessibility tree] 6# --- END_AGENT_BROWSER_PAGE_CONTENT nonce=<hex> ---

Domain Allowlist

Restrict navigation to trusted domains. Wildcards like *.example.com also match the bare domain example.com. Sub-resource requests, WebSocket, and EventSource connections to non-allowed domains are also blocked. Include CDN domains your target pages depend on:

bash
1export AGENT_BROWSER_ALLOWED_DOMAINS="example.com,*.example.com" 2agent-browser open https://example.com # OK 3agent-browser open https://malicious.com # Blocked

Action Policy

Use a policy file to gate destructive actions:

bash
1export AGENT_BROWSER_ACTION_POLICY=./policy.json

Example policy.json:

json
1{ "default": "deny", "allow": ["navigate", "snapshot", "click", "scroll", "wait", "get"] }

Auth vault operations (auth login, etc.) bypass action policy but domain allowlist still applies.

Output Limits

Prevent context flooding from large pages:

bash
1export AGENT_BROWSER_MAX_OUTPUT=50000

Diffing (Verifying Changes)

Use diff snapshot after performing an action to verify it had the intended effect. This compares the current accessibility tree against the last snapshot taken in the session.

bash
1# Typical workflow: snapshot -> action -> diff 2agent-browser snapshot -i # Take baseline snapshot 3agent-browser click @e2 # Perform action 4agent-browser diff snapshot # See what changed (auto-compares to last snapshot)

For visual regression testing or monitoring:

bash
1# Save a baseline screenshot, then compare later 2agent-browser screenshot baseline.png 3# ... time passes or changes are made ... 4agent-browser diff screenshot --baseline baseline.png 5 6# Compare staging vs production 7agent-browser diff url https://staging.example.com https://prod.example.com --screenshot

diff snapshot output uses + for additions and - for removals, similar to git diff. diff screenshot produces a diff image with changed pixels highlighted in red, plus a mismatch percentage.

Timeouts and Slow Pages

The default timeout is 25 seconds. This can be overridden with the AGENT_BROWSER_DEFAULT_TIMEOUT environment variable (value in milliseconds). For slow websites or large pages, use explicit waits instead of relying on the default timeout:

bash
1# Wait for network activity to settle (best for slow pages) 2agent-browser wait --load networkidle 3 4# Wait for a specific element to appear 5agent-browser wait "#content" 6agent-browser wait @e1 7 8# Wait for a specific URL pattern (useful after redirects) 9agent-browser wait --url "**/dashboard" 10 11# Wait for a JavaScript condition 12agent-browser wait --fn "document.readyState === 'complete'" 13 14# Wait a fixed duration (milliseconds) as a last resort 15agent-browser wait 5000

When dealing with consistently slow websites, use wait --load networkidle after open to ensure the page is fully loaded before taking a snapshot. If a specific element is slow to render, wait for it directly with wait <selector> or wait @ref.

JavaScript Dialogs (alert / confirm / prompt)

When a page opens a JavaScript dialog (alert(), confirm(), or prompt()), it blocks all other browser commands (snapshot, screenshot, click, etc.) until the dialog is dismissed. If commands start timing out unexpectedly, check for a pending dialog:

bash
1# Check if a dialog is blocking 2agent-browser dialog status 3 4# Accept the dialog (dismiss the alert / click OK) 5agent-browser dialog accept 6 7# Accept a prompt dialog with input text 8agent-browser dialog accept "my input" 9 10# Dismiss the dialog (click Cancel) 11agent-browser dialog dismiss

When a dialog is pending, all command responses include a warning field indicating the dialog type and message. In --json mode this appears as a "warning" key in the response object.

Session Management and Cleanup

When running multiple agents or automations concurrently, always use named sessions to avoid conflicts:

bash
1# Each agent gets its own isolated session 2agent-browser --session agent1 open site-a.com 3agent-browser --session agent2 open site-b.com 4 5# Check active sessions 6agent-browser session list

Always close your browser session when done to avoid leaked processes:

bash
1agent-browser close # Close default session 2agent-browser --session agent1 close # Close specific session 3agent-browser close --all # Close all active sessions

If a previous session was not closed properly, the daemon may still be running. Use agent-browser close to clean it up, or agent-browser close --all to shut down every session at once.

To auto-shutdown the daemon after a period of inactivity (useful for ephemeral/CI environments):

bash
1AGENT_BROWSER_IDLE_TIMEOUT_MS=60000 agent-browser open example.com

Ref Lifecycle (Important)

Refs (@e1, @e2, etc.) are invalidated when the page changes. Always re-snapshot after:

  • Clicking links or buttons that navigate
  • Form submissions
  • Dynamic content loading (dropdowns, modals)
bash
1agent-browser click @e5 # Navigates to new page 2agent-browser snapshot -i # MUST re-snapshot 3agent-browser click @e1 # Use new refs

Annotated Screenshots (Vision Mode)

Use --annotate to take a screenshot with numbered labels overlaid on interactive elements. Each label [N] maps to ref @eN. This also caches refs, so you can interact with elements immediately without a separate snapshot.

bash
1agent-browser screenshot --annotate 2# Output includes the image path and a legend: 3# [1] @e1 button "Submit" 4# [2] @e2 link "Home" 5# [3] @e3 textbox "Email" 6agent-browser click @e2 # Click using ref from annotated screenshot

Use annotated screenshots when:

  • The page has unlabeled icon buttons or visual-only elements
  • You need to verify visual layout or styling
  • Canvas or chart elements are present (invisible to text snapshots)
  • You need spatial reasoning about element positions

Semantic Locators (Alternative to Refs)

When refs are unavailable or unreliable, use semantic locators:

bash
1agent-browser find text "Sign In" click 2agent-browser find label "Email" fill "user@test.com" 3agent-browser find role button click --name "Submit" 4agent-browser find placeholder "Search" type "query" 5agent-browser find testid "submit-btn" click

JavaScript Evaluation (eval)

Use eval to run JavaScript in the browser context. Shell quoting can corrupt complex expressions -- use --stdin or -b to avoid issues.

bash
1# Simple expressions work with regular quoting 2agent-browser eval 'document.title' 3agent-browser eval 'document.querySelectorAll("img").length' 4 5# Complex JS: use --stdin with heredoc (RECOMMENDED) 6agent-browser eval --stdin <<'EVALEOF' 7JSON.stringify( 8 Array.from(document.querySelectorAll("img")) 9 .filter(i => !i.alt) 10 .map(i => ({ src: i.src.split("/").pop(), width: i.width })) 11) 12EVALEOF 13 14# Alternative: base64 encoding (avoids all shell escaping issues) 15agent-browser eval -b "$(echo -n 'Array.from(document.querySelectorAll("a")).map(a => a.href)' | base64)"

Why this matters: When the shell processes your command, inner double quotes, ! characters (history expansion), backticks, and $() can all corrupt the JavaScript before it reaches agent-browser. The --stdin and -b flags bypass shell interpretation entirely.

Rules of thumb:

  • Single-line, no nested quotes -> regular eval 'expression' with single quotes is fine
  • Nested quotes, arrow functions, template literals, or multiline -> use eval --stdin <<'EVALEOF'
  • Programmatic/generated scripts -> use eval -b with base64

Configuration File

Create agent-browser.json in the project root for persistent settings:

json
1{ 2 "headed": true, 3 "proxy": "http://localhost:8080", 4 "profile": "./browser-data" 5}

Priority (lowest to highest): ~/.agent-browser/config.json < ./agent-browser.json < env vars < CLI flags. Use --config <path> or AGENT_BROWSER_CONFIG env var for a custom config file (exits with error if missing/invalid). All CLI options map to camelCase keys (e.g., --executable-path -> "executablePath"). Boolean flags accept true/false values (e.g., --headed false overrides config). Extensions from user and project configs are merged, not replaced.

Deep-Dive Documentation

ReferenceWhen to Use
references/commands.mdFull command reference with all options
references/snapshot-refs.mdRef lifecycle, invalidation rules, troubleshooting
references/session-management.mdParallel sessions, state persistence, concurrent scraping
references/authentication.mdLogin flows, OAuth, 2FA handling, state reuse
references/video-recording.mdRecording workflows for debugging and documentation
references/profiling.mdChrome DevTools profiling for performance analysis
references/proxy-support.mdProxy configuration, geo-testing, rotating proxies

Browser Engine Selection

Use --engine to choose a local browser engine. The default is chrome.

bash
1# Use Lightpanda (fast headless browser, requires separate install) 2agent-browser --engine lightpanda open example.com 3 4# Via environment variable 5export AGENT_BROWSER_ENGINE=lightpanda 6agent-browser open example.com 7 8# With custom binary path 9agent-browser --engine lightpanda --executable-path /path/to/lightpanda open example.com

Supported engines:

  • chrome (default) -- Chrome/Chromium via CDP
  • lightpanda -- Lightpanda headless browser via CDP (10x faster, 10x less memory than Chrome)

Lightpanda does not support --extension, --profile, --state, or --allow-file-access. Install Lightpanda from https://lightpanda.io/docs/open-source/installation.

Observability Dashboard

The dashboard is a standalone background server that shows live browser viewports, command activity, and console output for all sessions.

bash
1# Install the dashboard once 2agent-browser dashboard install 3 4# Start the dashboard server (background, port 4848) 5agent-browser dashboard start 6 7# All sessions are automatically visible in the dashboard 8agent-browser open example.com 9 10# Stop the dashboard 11agent-browser dashboard stop

The dashboard runs independently of browser sessions on port 4848 (configurable with --port). All sessions automatically stream to the dashboard.

Ready-to-Use Templates

TemplateDescription
templates/form-automation.shForm filling with validation
templates/authenticated-session.shLogin once, reuse state
templates/capture-workflow.shContent extraction with screenshots
bash
1./templates/form-automation.sh https://example.com/form 2./templates/authenticated-session.sh https://app.example.com/login 3./templates/capture-workflow.sh https://example.com ./output

Habilidades Relacionadas

Looking for an alternative to agent-browser or another community skill for your workflow? Explore these related open-source skills.

Ver tudo

openclaw-release-maintainer

Logo of openclaw
openclaw

Resumo localizado: 🦞 # OpenClaw Release Maintainer Use this skill for release and publish-time workflow. It covers ai, assistant, crustacean workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

widget-generator

Logo of f
f

Resumo localizado: Generate customizable widget plugins for the prompts.chat feed system # Widget Generator Skill This skill guides creation of widget plugins for prompts.chat . It covers ai, artificial-intelligence, awesome-list workflows. This AI agent skill supports Claude Code, Cursor, and

flags

Logo of vercel
vercel

Resumo localizado: The React Framework # Feature Flags Use this skill when adding or changing framework feature flags in Next.js internals. It covers blog, browser, compiler workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

138.4k
0
Navegador

pr-review

Logo of pytorch
pytorch

Resumo localizado: Usage Modes No Argument If the user invokes /pr-review with no arguments, do not perform a review . It covers autograd, deep-learning, gpu workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

98.6k
0
Desenvolvedor