| name | browser-use |
| description | Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages. |
| allowed-tools | Bash(browser-use:*) |
Browser Automation with browser-use CLI
The browser-use command provides fast, persistent browser automation. It maintains browser sessions across commands, enabling complex multi-step workflows.
Installation
uvx "browser-use[cli]" open https://example.com
uv pip install "browser-use[cli]"
browser-use install
Setup
One-line install (recommended)
curl -fsSL https://browser-use.com/cli/install.sh | bash
This interactive installer lets you choose your installation mode and configures everything automatically.
Installation modes:
curl -fsSL https://browser-use.com/cli/install.sh | bash -s -- --remote-only
curl -fsSL https://browser-use.com/cli/install.sh | bash -s -- --local-only
curl -fsSL https://browser-use.com/cli/install.sh | bash -s -- --full
| Install Mode | Available Browsers | Default | Use Case |
|---|
--remote-only | remote | remote | Sandboxed agents, CI, no GUI |
--local-only | chromium, real | chromium | Local development |
--full | chromium, real, remote | chromium | Full flexibility |
When only one mode is installed, it becomes the default and no --browser flag is needed.
Pass API key during install:
curl -fsSL https://browser-use.com/cli/install.sh | bash -s -- --remote-only --api-key bu_xxx
Verify installation:
browser-use doctor
Setup wizard (first-time configuration):
browser-use setup
browser-use setup --mode local
browser-use setup --mode remote
browser-use setup --mode full
browser-use setup --api-key bu_xxx
browser-use setup --yes
Generate template files:
browser-use init
browser-use init --list
browser-use init --template basic
browser-use init --output my_script.py
browser-use init --force
Manual cloudflared install (for tunneling):
brew install cloudflared
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o ~/.local/bin/cloudflared && chmod +x ~/.local/bin/cloudflared
winget install Cloudflare.cloudflared
Quick Start
browser-use open https://example.com
browser-use state
browser-use click 5
browser-use type "Hello World"
browser-use screenshot
browser-use close
Core Workflow
- Navigate:
browser-use open <url> - Opens URL (starts browser if needed)
- Inspect:
browser-use state - Returns clickable elements with indices
- Interact: Use indices from state to interact (
browser-use click 5, browser-use input 3 "text")
- Verify:
browser-use state or browser-use screenshot to confirm actions
- Repeat: Browser stays open between commands
Browser Modes
browser-use --browser chromium open <url>
browser-use --browser chromium --headed open <url>
browser-use --browser real open <url>
browser-use --browser remote open <url>
- chromium: Fast, isolated, headless by default
- real: Uses your Chrome with cookies, extensions, logged-in sessions
- remote: Cloud-hosted browser with proxy support (requires BROWSER_USE_API_KEY)
Commands
Navigation
browser-use open <url>
browser-use back
browser-use scroll down
browser-use scroll up
browser-use scroll down --amount 1000
Page State
browser-use state
browser-use screenshot
browser-use screenshot path.png
browser-use screenshot --full path.png
Interactions (use indices from browser-use state)
browser-use click <index>
browser-use type "text"
browser-use input <index> "text"
browser-use keys "Enter"
browser-use keys "Control+a"
browser-use select <index> "option"
Tab Management
browser-use switch <tab>
browser-use close-tab
browser-use close-tab <tab>
JavaScript & Data
browser-use eval "document.title"
browser-use extract "all product prices"
Cookies
browser-use cookies get
browser-use cookies get --url <url>
browser-use cookies set <name> <value>
browser-use cookies set name val --domain .example.com --secure --http-only
browser-use cookies set name val --same-site Strict
browser-use cookies set name val --expires 1735689600
browser-use cookies clear
browser-use cookies clear --url <url>
browser-use cookies export <file>
browser-use cookies export <file> --url <url>
browser-use cookies import <file>
Wait Conditions
browser-use wait selector "h1"
browser-use wait selector ".loading" --state hidden
browser-use wait selector "#btn" --state attached
browser-use wait text "Success"
browser-use wait selector "h1" --timeout 5000
Additional Interactions
browser-use hover <index>
browser-use dblclick <index>
browser-use rightclick <index>
Information Retrieval
browser-use get title
browser-use get html
browser-use get html --selector "h1"
browser-use get text <index>
browser-use get value <index>
browser-use get attributes <index>
browser-use get bbox <index>
Python Execution (Persistent Session)
browser-use python "x = 42"
browser-use python "print(x)"
browser-use python "print(browser.url)"
browser-use python --vars
browser-use python --reset
browser-use python --file script.py
The Python session maintains state across commands. The browser object provides:
browser.url - Current page URL
browser.title - Page title
browser.html - Get page HTML
browser.goto(url) - Navigate
browser.click(index) - Click element
browser.type(text) - Type text
browser.input(index, text) - Click element, then type
browser.keys(keys) - Send keyboard keys (e.g., "Enter", "Control+a")
browser.screenshot(path) - Take screenshot
browser.scroll(direction, amount) - Scroll page
browser.back() - Go back in history
browser.wait(seconds) - Sleep/pause execution
browser.extract(query) - Extract data using LLM
Agent Tasks (Requires API Key)
browser-use run "Fill the contact form with test data"
browser-use run "Extract all product prices" --max-steps 50
Agent tasks use an LLM to autonomously complete complex browser tasks. Requires BROWSER_USE_API_KEY or configured LLM API key (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc).
Remote Mode Agent Options
When using --browser remote, additional options are available:
browser-use -b remote run "Search for AI news"
browser-use -b remote run "task" --llm gpt-4o
browser-use -b remote run "task" --llm claude-sonnet-4-20250514
browser-use -b remote run "task" --llm gemini-2.0-flash
browser-use -b remote run "task" --proxy-country gb
browser-use -b remote run "task" --proxy-country de
browser-use -b remote run "task 1" --keep-alive
browser-use -b remote run "task 2" --session-id abc-123
browser-use -b remote run "task" --no-wait
browser-use -b remote run "task" --stream
browser-use -b remote run "task" --flash
browser-use -b remote run "task" --thinking
browser-use -b remote run "task" --vision
browser-use -b remote run "task" --no-vision
browser-use -b remote run "task" --wait
browser-use -b remote run "task" --profile <cloud-profile-id>
browser-use -b remote run "task" --start-url https://example.com
browser-use -b remote run "task" --allowed-domain example.com
browser-use -b remote run "task" --metadata key=value
browser-use -b remote run "task" --secret API_KEY=xxx
browser-use -b remote run "task" --skill-id skill-123
browser-use -b remote run "task" --structured-output '{"type":"object"}'
browser-use -b remote run "task" --judge
browser-use -b remote run "task" --judge-ground-truth "expected answer"
Task Management (Remote Mode)
Manage cloud tasks when using remote mode:
browser-use task list
browser-use task list --limit 20
browser-use task list --status running
browser-use task list --session <id>
browser-use task list --json
browser-use task status <task-id>
browser-use task status <task-id> -c
browser-use task status <task-id> -v
browser-use task status <task-id> --last 5
browser-use task status <task-id> --step 3
browser-use task status <task-id> --reverse
browser-use task stop <task-id>
browser-use task logs <task-id>
Token-efficient monitoring: Default task status shows only the latest step. Use -c (compact) or -v (verbose) only when you need more context.
Cloud Session Management (Remote Mode)
Manage cloud browser sessions:
browser-use session list
browser-use session list --limit 20
browser-use session list --status active
browser-use session list --json
browser-use session get <session-id>
browser-use session get <session-id> --json
browser-use session stop <session-id>
browser-use session stop --all
browser-use session create
browser-use session create --profile <id>
browser-use session create --proxy-country gb
browser-use session create --start-url https://example.com
browser-use session create --screen-size 1920x1080
browser-use session create --keep-alive
browser-use session create --persist-memory
browser-use session share <session-id>
browser-use session share <session-id> --delete
Exposing Local Dev Servers
If you're running a dev server locally and need a cloud browser to reach it, use Cloudflare tunnels:
npm run dev &
browser-use tunnel 3000
browser-use --browser remote open https://abc.trycloudflare.com
Tunnel commands:
browser-use tunnel <port>
browser-use tunnel <port>
browser-use tunnel list
browser-use tunnel stop <port>
browser-use tunnel stop --all
Note: Tunnels are independent of browser sessions. They persist across browser-use close and can be managed separately.
Cloudflared is installed by install.sh. If missing, install manually (see Setup section).
Running Subagents (Remote Mode)
Cloud sessions and tasks provide a powerful model for running subagents - autonomous browser agents that execute tasks in parallel.
Key Concepts
- Session = Agent: Each cloud session is a browser agent with its own state (cookies, tabs, history)
- Task = Work: Tasks are jobs given to an agent. An agent can run multiple tasks sequentially
- Parallel agents: Run multiple sessions simultaneously for parallel work
- Session reuse: While a session is alive, you can assign it more tasks
- Session lifecycle: Once stopped, a session cannot be revived - start a new one
Basic Subagent Workflow
browser-use -b remote run "Search for AI news and summarize top 3 articles" --no-wait
browser-use task status task-abc
browser-use task logs task-abc
Running Parallel Subagents
Launch multiple agents to work simultaneously:
browser-use -b remote run "Research competitor A pricing" --no-wait
browser-use -b remote run "Research competitor B pricing" --no-wait
browser-use -b remote run "Research competitor C pricing" --no-wait
browser-use task list --status running
browser-use task status task-1
browser-use task status task-2
browser-use task status task-3
Reusing an Agent for Multiple Tasks
Keep a session alive to run sequential tasks in the same browser context:
browser-use -b remote run "Log into example.com" --keep-alive --no-wait
browser-use task status task-1
browser-use -b remote run "Navigate to settings and export data" --session-id sess-123 --no-wait
Managing Active Agents
browser-use session list --status active
browser-use session get sess-123
browser-use session stop sess-123
browser-use session stop --all
Stopping Tasks vs Sessions
browser-use task stop task-abc
browser-use session stop sess-123
Custom Agent Configuration
browser-use -b remote run "task" --no-wait
browser-use -b remote run "task" \
--llm gpt-4o \
--proxy-country gb \
--keep-alive \
--no-wait
browser-use -b remote run "task" --profile <profile-id> --no-wait
Monitoring Subagents
Task status is designed for token efficiency. Default output is minimal - only expand when needed:
| Mode | Flag | Tokens | Use When |
|---|
| Default | (none) | Low | Polling progress |
| Compact | -c | Medium | Need full reasoning |
| Verbose | -v | High | Debugging actions |
Recommended workflow:
browser-use -b remote run "task" --no-wait
browser-use task status abc-123
browser-use task status abc-123 -c
browser-use task status abc-123 -v
For long tasks (50+ steps):
browser-use task status <id> -c --last 5
browser-use task status <id> -c --reverse
browser-use task status <id> -v --step 10
Live view: Watch an agent work in real-time:
browser-use session get <session-id>
Detect stuck tasks: If cost/duration stops increasing, the task may be stuck:
browser-use task status <task-id>
Logs: Only available after task completes:
browser-use task logs <task-id>
Cleanup
Always clean up sessions after parallel work:
browser-use session stop --all
browser-use session stop <session-id>
Troubleshooting Subagents
Session reuse fails after task stop:
If you stop a task and try to reuse its session, the new task may get stuck at "created" status. Solution: create a new agent instead.
browser-use task stop <task-id>
browser-use -b remote run "new task" --session-id <same-session>
browser-use -b remote run "new task" --profile <profile-id>
Task stuck at "started":
- Check cost with
task status - if not increasing, task is stuck
- View live URL with
session get to see what's happening
- Stop the task and create a new agent
Sessions persist after tasks complete:
Tasks finishing doesn't auto-stop sessions. Clean up manually:
browser-use session list --status active
browser-use session stop --all
Session Management
browser-use sessions
browser-use close
browser-use close --all
Profile Management
Local Chrome Profiles (--browser real)
browser-use -b real profile list
Before opening a real browser (--browser real), always ask the user if they want to use a specific Chrome profile or no profile. Use profile list to show available profiles:
browser-use -b real profile list
browser-use --browser real --profile "Profile 1" open https://gmail.com
browser-use --browser real open https://gmail.com
browser-use --browser real --profile "Default" cookies export /tmp/cookies.json
Each Chrome profile has its own cookies, history, and logged-in sessions. Choosing the right profile determines whether sites will be pre-authenticated.
Cloud Profiles (--browser remote)
Cloud profiles store browser state (cookies) in Browser-Use Cloud, persisting across sessions. Requires BROWSER_USE_API_KEY.
browser-use -b remote profile list
browser-use -b remote profile list --page 2 --page-size 50
browser-use -b remote profile get <id>
browser-use -b remote profile create
browser-use -b remote profile create --name "My Profile"
browser-use -b remote profile update <id> --name "New"
browser-use -b remote profile delete <id>
Use a cloud profile with --browser remote --profile <id>:
browser-use --browser remote --profile abc-123 open https://example.com
Syncing Cookies to Cloud
⚠️ IMPORTANT: Before syncing cookies from a local browser to the cloud, the agent MUST:
- Ask the user which local Chrome profile to use (
browser-use -b real profile list)
- Ask which domain(s) to sync - do NOT default to syncing the full profile
- Confirm before proceeding
Default behavior: Create a NEW cloud profile for each domain sync. This ensures clear separation of concerns for cookies. Users can add cookies to existing profiles if needed.
Step 1: List available profiles and cookies
browser-use -b real profile list
browser-use -b real profile cookies "Default"
Step 2: Sync cookies (three levels of control)
1. Domain-specific sync (recommended default)
browser-use profile sync --from "Default" --domain youtube.com
This is the recommended approach - sync only the cookies you need.
2. Full profile sync (use with caution)
browser-use profile sync --from "Default"
⚠️ Warning: This syncs ALL cookies including sensitive data, tracking cookies, session tokens for every site, etc. Only use when the user explicitly needs their entire browser state.
3. Fine-grained control (advanced)
browser-use --browser real --profile "Default" cookies export /tmp/cookies.json
browser-use --browser remote --profile <id> cookies import /tmp/cookies.json
For users who need individual cookie-level control.
Step 3: Use the synced profile
browser-use --browser remote --profile <id> open https://youtube.com
Adding cookies to existing profiles:
browser-use --browser real --profile "Default" cookies export /tmp/cookies.json
browser-use --browser remote --profile <existing-id> cookies import /tmp/cookies.json
Managing profiles:
browser-use profile update <id> --name "New Name"
browser-use profile delete <id>
Server Control
browser-use server status
browser-use server stop
browser-use server logs
Setup
browser-use install
Global Options
| Option | Description |
|---|
--session NAME | Use named session (default: "default") |
--browser MODE | Browser mode: chromium, real, remote |
--headed | Show browser window (chromium mode) |
--profile NAME | Browser profile (local name or cloud ID) |
--json | Output as JSON |
--api-key KEY | Override API key |
--mcp | Run as MCP server via stdin/stdout |
Session behavior: All commands without --session use the same "default" session. The browser stays open and is reused across commands. Use --session NAME to run multiple browsers in parallel.
API Key Configuration
Some features (run, extract, --browser remote) require an API key. The CLI checks these locations in order:
--api-key command line flag
BROWSER_USE_API_KEY environment variable
~/.config/browser-use/config.json file
To configure permanently:
mkdir -p ~/.config/browser-use
echo '{"api_key": "your-key-here"}' > ~/.config/browser-use/config.json
Examples
Form Submission
browser-use open https://example.com/contact
browser-use state
browser-use input 0 "John Doe"
browser-use input 1 "john@example.com"
browser-use input 2 "Hello, this is a test message."
browser-use click 3
browser-use state
Multi-Session Workflows
browser-use --session work open https://work.example.com
browser-use --session personal open https://personal.example.com
browser-use --session work state
browser-use --session personal state
browser-use close --all
Data Extraction with Python
browser-use open https://example.com/products
browser-use python "
products = []
for i in range(20):
browser.scroll('down')
browser.screenshot('products.png')
"
browser-use python "print(f'Captured {len(products)} products')"
Using Real Browser (Logged-In Sessions)
browser-use --browser real open https://gmail.com
browser-use state
Common Patterns
Test a Local Dev Server with Cloud Browser
npm run dev &
browser-use tunnel 3000
browser-use --browser remote open https://abc.trycloudflare.com
browser-use state
browser-use screenshot
Screenshot Loop for Visual Verification
browser-use open https://example.com
for i in 1 2 3 4 5; do
browser-use scroll down
browser-use screenshot "page_$i.png"
done
Tips
- Always run
browser-use state first to see available elements and their indices
- Use
--headed for debugging to see what the browser is doing
- Sessions persist - the browser stays open between commands
- Use
--json for parsing output programmatically
- Python variables persist across
browser-use python commands within a session
- Real browser mode preserves your login sessions and extensions
- CLI aliases:
bu, browser, and browseruse all work identically to browser-use
Troubleshooting
Run diagnostics first:
browser-use doctor
Browser won't start?
browser-use install
browser-use server stop
browser-use --headed open <url>
Element not found?
browser-use state
browser-use scroll down
browser-use state
Session issues?
browser-use sessions
browser-use close --all
browser-use open <url>
Cleanup
Always close the browser when done. Run this after completing browser automation:
browser-use close