Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

telemetry, fix issues docs: remove rust; skills.sh install cmd

Laith Weinberger44f017fbc285
diff --git a/README.md b/README.md
index 62ddb801d..cdc0312bd 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,7 @@
**Browser Use CLI 3.0 is here.** Give your coding agent a browser it can use reliably:
```bash
-uv tool install browser-use
-browser-use skill install
+npx skills add https://github.com/browser-use/browser-use --skill browser-use
```
Or try the hosted agent in [Browser Use Cloud](https://cloud.browser-use.com?utm_source=github&utm_medium=readme&utm_campaign=cli_3_0_launch).
@@ -58,21 +57,12 @@ Or try the hosted agent in [Browser Use Cloud](https://cloud.browser-use.com?utm
# 👋 Human Quickstart
-Browser Use 0.13 introduces a new beta agent powered by a Rust core and a browser harness built for current frontier models. It gives the model a real browser/computer action space, persistent tools, and recovery loops inspired by coding agents.
-
-```text
-Python API -> Rust core -> Browser harness -> Web task done
-```
-
-**1. Install Browser Use with the native core runtime (Python>=3.11):**
+**1. Install Browser Use (Python>=3.11):**
```bash
-uv add "browser-use[core]"
-# or: pip install "browser-use[core]"
-browser
+uv add browser-use
+# or: pip install browser-use
```
-The `[core]` extra installs the native Browser Use runtime for your platform.
-
**2. [Optional] Get your API key from [Browser Use Cloud](https://cloud.browser-use.com/new-api-key?utm_source=github&utm_medium=readme-quickstart-api-key):**
```
# .env
@@ -83,19 +73,12 @@ BROWSER_USE_API_KEY=your-key
**3. Run your first agent:**
-**Browser Use Terminal:**
-```bash
-uv add "browser-use[core]"
-browser
-```
-
**Python Script:**
```python
-from browser_use.beta import Agent, BrowserProfile, ChatBrowserUse
-# from browser_use.beta import ChatOpenAI # ChatOpenAI(model='gpt-5.5')
-# from browser_use.beta import ChatAnthropic # ChatAnthropic(model='claude-opus-4-8')
import asyncio
+from browser_use import Agent, BrowserProfile, ChatBrowserUse
+
async def main():
agent = Agent(
task="Find the number of stars of the browser-use repo",
@@ -115,8 +98,6 @@ if __name__ == "__main__":
asyncio.run(main())
```
-Existing Python agent users can keep using `from browser_use import Agent`. The new Rust-powered beta agent is `from browser_use.beta import Agent`.
-
Check out the [library docs](https://docs.browser-use.com/open-source/introduction) and the [cloud docs](https://docs.cloud.browser-use.com?utm_source=github&utm_medium=readme-cloud-docs) for more!
<br/>
@@ -212,7 +193,7 @@ The CLI allows your agent to control the browser via Python, and it manages the
For Claude Code, Codex, and other agents, install the Browser Use skill:
```bash
-browser-use skill install
+npx skills add https://github.com/browser-use/browser-use --skill browser-use
```
<br/>
diff --git a/browser_use/cli.py b/browser_use/cli.py
index fa8f18db7..a11921008 100644
--- a/browser_use/cli.py
+++ b/browser_use/cli.py
@@ -3,10 +3,80 @@
from __future__ import annotations
import sys
+import time
from contextlib import redirect_stderr, redirect_stdout
+from importlib.metadata import PackageNotFoundError, version
from io import StringIO
+def _browser_use_version() -> str:
+ try:
+ return version('browser-use')
+ except PackageNotFoundError:
+ return 'unknown'
+
+
+def _exit_code(result: int | str | None) -> int:
+ if result is None:
+ return 0
+ if isinstance(result, int):
+ return result
+ return 1
+
+
+def _first_env_value(names: tuple[str, ...]) -> str | None:
+ import os
+
+ for name in names:
+ value = os.environ.get(name)
+ if value:
+ return value
+ return None
+
+
+def _detect_agent_client() -> str | None:
+ return _first_env_value(('BROWSER_USE_AGENT_CLIENT',))
+
+
+def _detect_model() -> tuple[str | None, str | None]:
+ return _first_env_value(('BROWSER_USE_AGENT_MODEL',)), _first_env_value(('BROWSER_USE_MODEL_PROVIDER',))
+
+
+def _capture_cli_event(
+ *,
+ action: str,
+ mode: str,
+ command: str,
+ start_time: float,
+ task: str | None = None,
+ result: int | str | None = None,
+ error_message: str | None = None,
+) -> None:
+ try:
+ from browser_use.telemetry import CLITelemetryEvent, ProductTelemetry
+
+ model, model_provider = _detect_model()
+ telemetry = ProductTelemetry()
+ telemetry.capture(
+ CLITelemetryEvent(
+ version=_browser_use_version(),
+ action=action,
+ mode=mode,
+ command=command,
+ task=task,
+ agent_client=_detect_agent_client(),
+ model=model,
+ model_provider=model_provider,
+ duration_seconds=time.monotonic() - start_time,
+ exit_code=_exit_code(result),
+ error_message=error_message,
+ )
+ )
+ telemetry.flush()
+ except Exception:
+ pass
+
+
def _run_mcp_server() -> None:
import asyncio
import logging
@@ -121,8 +191,11 @@ def _patch_browser_harness_cli_text() -> None:
def _run_browser_harness() -> int | None:
+ import os
+
from browser_harness import run
+ os.environ['BH_CLIENT'] = 'browser-use-cli'
_patch_browser_harness_cli_text()
args = sys.argv[1:]
if args and args[0] == 'doctor' and args[1:]:
@@ -136,28 +209,84 @@ def _run_browser_harness() -> int | None:
return None
-def browser_use_tui_main() -> int | None:
- print('browser-use-tui is deprecated; use browser-use instead.', file=sys.stderr)
- return main()
+def _read_harness_task(args: list[str]) -> str | None:
+ for flag in ('-c', '--code'):
+ if flag in args:
+ index = args.index(flag)
+ if index + 1 < len(args):
+ return args[index + 1]
+ if args or sys.stdin.isatty():
+ return None
+ code = sys.stdin.read()
+ sys.stdin = StringIO(code)
+ return code
-def main() -> int | None:
- args = sys.argv[1:]
+def _dispatch(args: list[str]) -> tuple[int | None, str, str, str | None]:
if '--mcp' in args:
_run_mcp_server()
- return 0
+ return 0, 'mcp_server', 'mcp', None
if args and args[0] == 'install':
- return _run_install_command(args[1:])
+ return _run_install_command(args[1:]), 'install', 'install', None
if args and args[0] == 'init':
- return _run_init_command(args[1:])
+ return _run_init_command(args[1:]), 'init', 'init', None
if '--template' in args or '-t' in args:
- return _run_init_command(args)
+ return _run_init_command(args), 'init', 'init', None
if args and args[0] == 'skill':
from browser_use.skills.install import handle as handle_skill_command
- return handle_skill_command(args[1:])
+ return handle_skill_command(args[1:]), 'skill', 'skill', None
+
+ task = _read_harness_task(args)
+ return _run_browser_harness(), 'browser_harness', args[0] if args else 'run', task
+
- return _run_browser_harness()
+def browser_use_tui_main() -> int | None:
+ print('browser-use-tui is deprecated; use browser-use instead.', file=sys.stderr)
+ return main()
+
+
+def main() -> int | None:
+ args = sys.argv[1:]
+ start_time = time.monotonic()
+ mode = 'browser_harness'
+ command = args[0] if args else 'run'
+ task = None
+ try:
+ result, mode, command, task = _dispatch(args)
+ except SystemExit as exc:
+ result = exc.code
+ _capture_cli_event(
+ action='error' if _exit_code(result) else 'completed',
+ mode=mode,
+ command=command,
+ start_time=start_time,
+ task=task,
+ result=result,
+ error_message=str(result) if isinstance(result, str) else None,
+ )
+ raise
+ except Exception as exc:
+ _capture_cli_event(
+ action='error',
+ mode=mode,
+ command=command,
+ start_time=start_time,
+ task=task,
+ result=1,
+ error_message=str(exc),
+ )
+ raise
+
+ _capture_cli_event(
+ action='error' if _exit_code(result) else 'completed',
+ mode=mode,
+ command=command,
+ start_time=start_time,
+ task=task,
+ result=result,
+ )
+ return result
if __name__ == '__main__':
diff --git a/browser_use/skills/browser-use/SKILL.md b/browser_use/skills/browser-use/SKILL.md
index 994aade1e..d81877923 100644
--- a/browser_use/skills/browser-use/SKILL.md
+++ b/browser_use/skills/browser-use/SKILL.md
@@ -20,7 +20,7 @@ PY
```
- Invoke as `browser-use`. Use heredocs for multi-line commands.
-- Helpers are pre-imported. `run.py` calls `ensure_daemon()` before `exec`.
+- Helpers are pre-imported and the CLI starts or connects to the Browser Harness daemon before running your code.
- First navigation is `new_tab(url)`, not `goto_url(url)`.
- The normal local flow attaches to the running Chrome/Chromium CDP endpoint. No browser ids or local profile selection.
@@ -48,10 +48,11 @@ Use Browser Use cloud for headless servers, parallel sub-agents, or isolated wor
browser-use auth login
```
-Or import a key safely:
+Or use an API key in a noninteractive shell:
```bash
-browser-use auth login --api-key-stdin
+export BROWSER_USE_API_KEY=bu_...
+browser-use auth status
```
Pick a short made-up name; `r7k2` below is just a placeholder:
diff --git a/browser_use/skills/install.py b/browser_use/skills/install.py
index 35e15a3ca..44595885c 100644
--- a/browser_use/skills/install.py
+++ b/browser_use/skills/install.py
@@ -9,9 +9,13 @@ from pathlib import Path
SKILL_NAME = 'browser-use'
DEFAULT_TARGET = 'all'
TARGET_DIRS = {
+ 'agents': Path.home() / '.agents' / 'skills' / SKILL_NAME,
'claude': Path.home() / '.claude' / 'skills' / SKILL_NAME,
'codex': Path.home() / '.codex' / 'skills' / SKILL_NAME,
- 'agents': Path.home() / '.agents' / 'skills' / SKILL_NAME,
+ 'copilot': Path.home() / '.copilot' / 'skills' / SKILL_NAME,
+ 'cursor': Path.home() / '.cursor' / 'skills' / SKILL_NAME,
+ 'gemini': Path.home() / '.gemini' / 'skills' / SKILL_NAME,
+ 'opencode': Path.home() / '.config' / 'opencode' / 'skills' / SKILL_NAME,
}
diff --git a/browser_use/telemetry/views.py b/browser_use/telemetry/views.py
index 252b9c879..08c62e80a 100644
--- a/browser_use/telemetry/views.py
+++ b/browser_use/telemetry/views.py
@@ -93,11 +93,15 @@ class CLITelemetryEvent(BaseTelemetryEvent):
"""Telemetry event for CLI usage"""
version: str
- action: str # 'start', 'message_sent', 'task_completed', 'error'
- mode: str # 'interactive', 'oneshot', 'mcp_server'
+ action: str # 'completed', 'error'
+ mode: str # 'browser_harness', 'install', 'init', 'skill', 'mcp_server'
+ command: str | None = None
+ task: str | None = None
+ agent_client: str | None = None
model: str | None = None
model_provider: str | None = None
duration_seconds: float | None = None
+ exit_code: int | None = None
error_message: str | None = None
name: str = 'cli_event'
diff --git a/pyproject.toml b/pyproject.toml
index 9320e2a92..a03ba975a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -46,7 +46,7 @@ dependencies = [
"markdownify==1.2.2",
"python-docx==1.2.0",
"browser-use-sdk==3.4.2",
- "browser-harness",
+ "browser-harness>=0.1.3,<0.2.0",
]
# google-api-core: only used for Google LLM APIs
# pyperclip: only used for examples that use copy/paste
diff --git a/tests/ci/test_browser_use_skill_install_docs.py b/tests/ci/test_browser_use_skill_install_docs.py
index d157e509f..535771c96 100644
--- a/tests/ci/test_browser_use_skill_install_docs.py
+++ b/tests/ci/test_browser_use_skill_install_docs.py
@@ -5,6 +5,15 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
BROWSER_USE_REPO_SKILL_URL = 'https://raw.githubusercontent.com/browser-use/browser-use/main/skills/browser-use/SKILL.md'
+EXPECTED_SKILL_INSTALL_PATHS = (
+ Path('.agents') / 'skills' / 'browser-use' / 'SKILL.md',
+ Path('.claude') / 'skills' / 'browser-use' / 'SKILL.md',
+ Path('.codex') / 'skills' / 'browser-use' / 'SKILL.md',
+ Path('.copilot') / 'skills' / 'browser-use' / 'SKILL.md',
+ Path('.cursor') / 'skills' / 'browser-use' / 'SKILL.md',
+ Path('.gemini') / 'skills' / 'browser-use' / 'SKILL.md',
+ Path('.config') / 'opencode' / 'skills' / 'browser-use' / 'SKILL.md',
+)
def _fake_browser_harness_tools(tmp_path: Path, skill_text: str) -> Path:
@@ -51,11 +60,7 @@ def test_browser_use_cli_installs_browser_harness_package_skill(tmp_path):
bin_dir = _fake_browser_harness_tools(tmp_path, '---\nname: browser-harness\n---\n\n# Browser Harness\n')
home = tmp_path / 'home'
- for stale in (
- home / '.claude' / 'skills' / 'browser-use' / 'SKILL.md',
- home / '.codex' / 'skills' / 'browser-use' / 'SKILL.md',
- home / '.agents' / 'skills' / 'browser-use' / 'SKILL.md',
- ):
+ for stale in (home / path for path in EXPECTED_SKILL_INSTALL_PATHS):
stale.parent.mkdir(parents=True)
stale.write_text('stale browser-use skill', encoding='utf-8')
@@ -84,11 +89,7 @@ def test_browser_use_cli_installs_browser_harness_package_skill(tmp_path):
'---\n\n'
'# Browser Use\n'
)
- for installed in (
- home / '.claude' / 'skills' / 'browser-use' / 'SKILL.md',
- home / '.codex' / 'skills' / 'browser-use' / 'SKILL.md',
- home / '.agents' / 'skills' / 'browser-use' / 'SKILL.md',
- ):
+ for installed in (home / path for path in EXPECTED_SKILL_INSTALL_PATHS):
assert installed.read_text(encoding='utf-8') == expected