Commit Graph

8574 Commits

Author SHA1 Message Date
Laith Weinberger 4dffd32a9b fix: use ValueError in validator, write key files with 0o600, use httpserver in tests 2026-02-16 18:12:13 -05:00
Laith Weinberger 712428f88d add web bot auth (RFC 9421)
generate(), public_jwk, keyid, save_private_key + auto-signing via CDP
2026-02-16 17:55:58 -05:00
Saurav Panda 8871ebafeb preview release (#4093)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Prepare preview release 0.11.10a1 by updating the package version in
pyproject.toml. This enables publishing an alpha build for early
testing.

<sup>Written for commit 90e6143ff8.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
0.11.10a1
2026-02-12 12:27:45 -08:00
Saurav Panda 90e6143ff8 preview release 2026-02-12 12:26:13 -08:00
shawn pana 9777959359 feat(install): always install from GitHub main branch (#4092)
Changes install.sh to clone from github.com/browser-use/browser-use@main
by default instead of installing from PyPI. Custom branches and repos
can still be specified via BROWSER_USE_BRANCH and BROWSER_USE_REPO
environment variables.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Update install.sh to install browser-use from
github.com/browser-use/browser-use@main by default instead of PyPI. You
can still install a specific branch or fork by setting
BROWSER_USE_BRANCH and BROWSER_USE_REPO.

<sup>Written for commit 8af57fa19a.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-12 11:44:48 -08:00
ShawnPana 8af57fa19a feat(install): always install from GitHub main branch
Changes install.sh to clone from github.com/browser-use/browser-use@main
by default instead of installing from PyPI. Custom branches and repos
can still be specified via BROWSER_USE_BRANCH and BROWSER_USE_REPO
environment variables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 11:37:18 -08:00
shawn pana 20fc3cb1b5 better installation and more cli features (#4078)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Streamlines installation and expands the CLI with mode-based setup,
health checks, unified cloud/local management, robust tunnels, and
SDK‑verified LLM selection. Also includes minor CI lint fixes in tests.

- **New Features**
- Installer: mode-based install (--remote-only/--local-only/--full),
writes install-config.json, optional API key, cross‑platform cloudflared
install (Windows via winget/direct), venv handling, CI-friendly
non‑interactive flow, gum TUI with Windows fixes, auto PATH config
(registry + PowerShell profile), unified install URL; script moved to
browser_use/skill_cli/install.sh (public URL unchanged).
- CLI: setup and doctor (prints detailed check results); unified profile
management (local/cloud via SDK); cloud task/session ops (including
session create/share), new filters/flags (--session, --metadata,
--secret, --allowed-domain, --skill-id, --structured-output, --judge,
--judge-ground-truth, --start-url); token‑efficient monitoring
(--compact/--verbose/--last/--reverse/--step) with durations; LLM
selection via SDK‑verified lists with updated defaults (o3,
claude-sonnet-4-0, gemini-flash-latest).
- Remote tasks: async by default; --wait prints task_id/session_id
immediately, shows a simple progress indicator, forwards all cloud‑only
flags, polls without blocking, and handles Ctrl+C without canceling the
task.
- Routing/safety: local vs remote agent routing with no client‑side
defaults; metadata detects browser‑mode mismatches with clear guidance;
local mode doesn’t require a Browser‑Use API key.
- Tunnels: fully decoupled from sessions, persist across CLI exit, stop
--all supported, invoked without starting a session; implementation
consolidated into a single tunnel.py module for reliability.
- Cross‑platform fixes: Windows server stability (127.0.0.1 binding, PID
checks, no console window, port reuse); file‑lock based session server
lifecycle via portalocker to prevent race conditions/orphaned processes
(with stale cleanup and longer socket timeout); macOS PATH updates; CI
adds install.sh tests across macOS/Linux/Windows; refactor to
cloud_task.py/cloud_session.py with a shared SDK client; ruff fixes;
expanded docs and skills; minor CI lint cleanups in tests.

- **Migration**
- Installation modes: requesting an unavailable mode errors with
reinstall guidance; messages now suggest --remote-only in addition to
--full and --local-only (use install.sh with
--full/--remote-only/--local-only).
- Remote tasks return immediately; use --wait to block. With --wait, IDs
print immediately and Ctrl+C won’t cancel the remote task.
- Tunnels are independent; browser-use close no longer stops them. Use
browser-use tunnel stop <port> or --all.
- In remote workflows, --browser remote is only needed on the first
command in a session.
- LLM model selection now uses SDK‑verified lists; the browser-use/*
pattern is no longer supported. Use bu-latest/bu-1-0/bu-2-0 or provider
model IDs.

<sup>Written for commit bff682fee6.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-12 10:42:15 -08:00
ShawnPana bff682fee6 fix: address CI lint failures
- Remove unused `import os` from test_doctor_command.py
- Add assert for proc.stdout in test_server_locking.py to satisfy pyright

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 10:36:27 -08:00
ShawnPana 99b0fab320 test(doctor): remove mocking, use real objects per test policy
- Removed all unittest.mock.patch usage
- Tests now use real functions and verify structure/behavior
- Use monkeypatch for env vars (acceptable for test isolation)
- Tests adapt to system state (cloudflared may or may not exist)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 10:30:12 -08:00
ShawnPana a1d20ed81c fix(cli): include --remote-only in remote mode error messages
Previously only suggested --full, but --remote-only is a lighter-weight
option when users only need cloud browser support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 10:26:31 -08:00
ShawnPana 5ccfc44da8 refactor: move install.sh to browser_use/skill_cli/
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 10:19:45 -08:00
ShawnPana c8242e7edd fix(cli): prevent orphaned server processes with flock-based locking
The session server had a race condition where concurrent CLI calls could
spawn multiple server processes. The old server would be orphaned when
the new one overwrote the PID file and deleted its socket.

Changes:
- Add flock-based locking using portalocker (already a dependency)
- Server acquires exclusive lock before writing PID file
- CLI checks both is_server_running() AND is_session_locked()
- Add kill_orphaned_server() to clean up servers with PID but no lock
- Increase socket timeout from 0.1s to 0.5s for reliability
- cleanup_session_files() now removes .lock and .meta files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 10:10:05 -08:00
ShawnPana 4d8c4e5e48 refactor(cli): consolidate tunnel code into single tunnel.py
- Rename tunnel_manager.py to tunnel.py
- Remove dead code: commands/tunnel.py (session-scoped implementation never reached)
- Remove TunnelInfo dataclass and tunnels field from sessions.py
- Remove tunnel routing from server.py (unreachable code path)
- Update imports in main.py, doctor.py, setup.py, and tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 02:09:55 -08:00
ShawnPana 7706c55532 refactor(cli): consolidate SDK/task/session files into cloud_task.py and cloud_session.py
- Create commands/utils.py with SDK singleton and format_duration helper
- Merge task_management.py into cloud_task.py (SDK wrappers + CLI handlers)
- Create cloud_session.py from session parts of cloud_task.py + session_management.py
- Delete sdk.py, task_management.py, session_management.py
- Update imports in main.py, agent.py, profile.py, __init__.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 01:47:44 -08:00
ShawnPana 5aeb6beeb5 style: fix ruff lint/format issues
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 01:07:22 -08:00
ShawnPana 856cae6947 fix(install): make Windows PATH config non-interactive
Remove the interactive confirmation prompt for Windows PATH
configuration. Now behaves consistently with macOS/Linux which
automatically add to shell rc files without prompting.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 01:02:44 -08:00
ShawnPana ada8b77d0b docs(cli): add missing commands and flags to skill documentation
- Add missing commands: init, setup, session create, session share, profile create
- Add missing agent run flags: --wait, --start-url, --metadata, --secret,
  --allowed-domain, --skill-id, --structured-output, --judge, --judge-ground-truth
- Add missing task status flags: --step, --reverse, --session filter
- Add missing cookie flags: --same-site, --expires
- Add scroll --amount, get bbox, profile pagination flags
- Add Python execution section to remote-browser/SKILL.md
- Add Cloud Profile Management section to remote-browser/SKILL.md
- Add missing browser wrapper methods to Python docs
- Fix incorrect profile list-local command references

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 00:46:35 -08:00
ShawnPana 79e91e6adf fix(cli): update install script URL to /cli/install.sh
Update all references from browser-use.com/install.sh to
browser-use.com/cli/install.sh across documentation and code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 00:24:48 -08:00
ShawnPana 22d7c53700 fix(cli): revert chat.py changes, hardcode browser-use models in CLI
Reverts changes to browser_use/llm/browser_use/chat.py to keep
CLI changes isolated. Browser-use models are now hardcoded in
agent.py instead of importing from chat.py.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 23:56:15 -08:00
ShawnPana fae720ba77 fix(cli): address cubic review concerns
- Forward all cloud-only flags in _handle_remote_run_with_wait
  Previously only forwarded 6 params; now includes session_id, vision,
  metadata, secrets, allowed_domains, skill_ids, structured_output,
  judge, judge_ground_truth, plus session creation for profile/proxy

- Use asyncio.to_thread for blocking SDK call in poll_until_complete
  Prevents client.tasks.get_task from blocking the event loop while
  polling for task completion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 23:53:25 -08:00
shawn pana b9c4196b93 Update install.sh
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-02-11 23:53:02 -08:00
shawn pana a8fa7f3fa2 Update browser_use/skill_cli/README.md
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-02-11 23:52:42 -08:00
shawn pana a2e9a33b8f Update browser_use/skill_cli/README.md
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-02-11 23:52:33 -08:00
ShawnPana af9383a2c7 refactor(cli): use SDK verified model lists instead of hardcoded prefixes
- Replace _get_provider_from_model() prefix inference (gpt-*, claude-*, etc.)
  with _get_provider_for_model() that checks SDK Literal types directly:
  - OpenAI: openai.types.shared.chat_model.ChatModel
  - Anthropic: anthropic.types.model_param.ModelParam
  - Google: browser_use.llm.google.chat.VerifiedGeminiModels
  - Browser-Use: VALID_BROWSER_USE_MODELS constant

- Add VALID_BROWSER_USE_MODELS constant to ChatBrowserUse for consistency

- Simplify get_llm() to use native browser-use Chat classes instead of
  langchain imports with try/except fallbacks

- Update default models: o3, claude-sonnet-4-0, gemini-flash-latest

- Remove browser-use/* pattern support (cloud models only)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 23:49:11 -08:00
ShawnPana c5dcb52cc9 fix(cli): make poll_until_complete async and show task_id immediately with --wait
Changes:

1. cloud_task.py: Convert poll_until_complete to async
   - Use `await asyncio.sleep()` instead of blocking `time.sleep()`
   - Properly yields control to event loop during polling

2. agent.py: Simplify poll call
   - Just `await cloud_task.poll_until_complete()` directly
   - Remove unnecessary `asyncio.to_thread()` wrapper

3. main.py: Handle --wait directly for immediate feedback
   - Bypass server for remote + run + --wait
   - Print task_id and session_id immediately after task creation
   - Show "waiting... done." progress indicator
   - Handle Ctrl+C gracefully (task continues remotely)
   - Use asyncio.run() for clean event loop management

Before:
  $ browser-use -b remote run "task" --wait
  # (waits silently, then shows everything at once)

After:
  $ browser-use -b remote run "task" --wait
  mode: remote
  task_id: abc123
  session_id: xyz789
  waiting... done.
  status: finished
  output: result here

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 23:12:27 -08:00
shawn pana b8e9dc2a62 Merge branch 'main' into frictionless-install 2026-02-11 19:28:55 -08:00
ShawnPana af1ac137c0 fix(cli): run blocking poll in thread to avoid blocking event loop
Use asyncio.to_thread() for poll_until_complete to prevent time.sleep()
from blocking the async event loop when --wait is used.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 19:24:43 -08:00
ShawnPana 1a9f51c541 refactor(cli): use browser-use-sdk for all cloud operations
Replace custom HTTP client with browser-use-sdk for tasks and sessions,
completing the SDK migration started in 8a992229.

## SDK Migration
- Add `sdk.py` with singleton client factory (`get_sdk_client()`)
- Rewrite `cloud_task.py` to use SDK (-300 lines)
- All functions return typed SDK models (TaskView, SessionView, etc.)
- Add `_filter_none()` to omit None values (SDK sends null, API rejects)

## No Client-Side Defaults
- Remove hardcoded defaults from CLI (max_steps, proxy_country, etc.)
- Let API use its own defaults (documented at docs.cloud.browser-use.com)
- Only pass values user explicitly sets

## New CLI Features
- `session create` - create session without task
- `session share <id>` - create/delete public share URLs
- `task list --session <id>` - filter tasks by session
- New task flags: --metadata, --secret, --allowed-domain, --skill-id,
  --structured-output, --judge, --judge-ground-truth, --start-url

## Async by Default
- Change `--no-wait` to `--wait` (flip default behavior)
- Tasks return immediately with task_id by default
- Use `--wait` to block until completion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 19:12:32 -08:00
ShawnPana 8a9922291d refactor(cli): use browser-use-sdk for cloud profile operations
Replace raw urllib HTTP calls with the official browser-use-sdk client
for all cloud profile API operations. This provides:

- Type-safe responses (ProfileView, ProfileListResponse)
- Cleaner error handling via SDK exceptions
- Consistent SDK usage pattern (matches skills/service.py)
- Removes 40 lines of manual HTTP/auth handling from main.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 16:39:08 -08:00
Saurav Panda 8bdcd3f839 fix: retry select_dropdown when options are lazily populated (#4084)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Fixes select_dropdown failures when options are lazily populated by
focusing the element and retrying once after a 1s wait. Improves
reliability on pages that load options on focus; also fixes a comment
linting issue.

- **Bug Fixes**
- Detect all-empty options, call element.focus(), wait 1s, then rerun
the selection script once.
- Avoid synthetic mouse events (isTrusted=false); keep click fallback
when selectionReverted.

<sup>Written for commit 30a8b0f66c.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-11 16:10:16 -08:00
Saurav Panda 30a8b0f66c Merge branch 'main' into drop-down-click-failure 2026-02-11 15:43:54 -08:00
Saurav Panda 4857d190e3 comment linting issue 2026-02-11 15:01:25 -08:00
shawn pana 0d30058285 Merge branch 'browser-use:main' into frictionless-install 2026-02-11 13:41:14 -08:00
Saurav Panda 9d1a103e7f increase default consecutive failure to 5 (#4080)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Increase the default consecutive failure threshold from 3 to 5 and
restore the original guard so only single-action step errors increment
consecutive failures (multi-action steps are handled by loop detection).
Improve browser-closed detection to trigger only on real CDP/WebSocket
connection failures, reducing false positives.

<sup>Written for commit ae3b8be538.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-11 11:14:30 -08:00
ShawnPana 7d088f19ae docs(cli): add prerequisites section and Windows troubleshooting
- Move prerequisites before install commands (no longer hidden)
- Add Windows troubleshooting section with common issues
- Minor wording improvements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 10:59:02 -08:00
ShawnPana e8576859d7 docs(cli): update README with all new commands
- Installation: one-line install with platform notes, manual install option
- Agent tasks: local and remote mode with all flags
- Task management: list, status, stop, logs
- Cloud sessions: list, get, stop
- Tunnels: expose local servers to cloud browsers
- Profile management: local and cloud profiles
- New commands: hover, dblclick, rightclick, cookies, wait, get

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 10:37:24 -08:00
ShawnPana 048d8e0995 fix(install): Windows improvements
- Auto-install cloudflared via winget
- Use registry for PATH (works in PowerShell + Command Prompt)
- Add confirmation prompt before modifying registry

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 10:18:31 -08:00
ShawnPana 720f2e0a8f feat(install): auto-configure PowerShell PATH on Windows
- Add configure_powershell_path() to write to PowerShell profile
- Supports both PowerShell 7+ and Windows PowerShell 5.x
- Updates Next steps message to just say "Restart PowerShell"
- Updates troubleshooting docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 23:25:59 -08:00
ShawnPana fd3db0615a fix(cli): hide server console window on Windows
Use CREATE_NO_WINDOW instead of DETACHED_PROCESS to prevent
a blank console window from appearing when the server starts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 23:19:56 -08:00
ShawnPana 24651c7565 fix(install): correct gum.exe extraction path on Windows
The Windows zip contains a subdirectory (gum_x.x.x_Windows_x86_64/gum.exe),
not gum.exe at the root level.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 23:16:39 -08:00
ShawnPana 31ecadb01f fix(install): make more platform-aware for Windows
- Add Windows gum TUI installation (was skipped before)
- Show PowerShell syntax for API key export ($env: instead of export)
- Already had Windows-specific PATH instructions from previous commit

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 23:12:23 -08:00
ShawnPana 13b2708609 fix(install): show Windows-specific PATH instructions
On Windows, show PowerShell PATH command instead of 'source ~/.bashrc'
which doesn't work in PowerShell.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 23:10:51 -08:00
ShawnPana da5803ab53 docs(install): expand Windows troubleshooting guide
- Add step-by-step instructions for "Failed to start session server"
- Document how to find and kill zombie processes (netstat + taskkill)
- Add section on debugging server issues with foreground mode
- Note that taskkill is needed before deleting venv

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 23:03:06 -08:00
ShawnPana 5e811e2ba4 fix(cli): Windows compatibility fixes for session server
- Use ctypes.OpenProcess on Windows for process existence check
  (os.kill raises WinError 87 or SystemError on Windows)
- Use 127.0.0.1 instead of localhost to avoid IPv6 binding issues
- Add reuse_address=True to asyncio.start_server for TCP port reuse

Fixes issues reported in:
- #3912 (os.kill fails on Windows)
- #3918 (WinError 87 in is_server_running)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 22:48:53 -08:00
ShawnPana d4b1a243c0 fix(cli): doctor command now shows check results
Previously doctor said "See details above" but never printed the actual
check results. Now prints each check with status icon and details.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 22:24:01 -08:00
ShawnPana 538cfefa83 docs(install): add Windows installation troubleshooting guide
Document known issues and solutions for Windows installation:
- Python 3.14+ asyncio breaking changes
- ARM64 Windows requiring x64 Python for package compatibility
- Multiple Python versions and py launcher behavior
- Stale venv cleanup instructions
- PowerShell PATH setup (vs Git Bash)
- Server startup troubleshooting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 22:21:07 -08:00
Saurav Panda ae3b8be538 reverted to original gaurd for multi action failure 2026-02-10 20:56:03 -08:00
Saurav Panda 8263a8d91d change max failure to 5 2026-02-10 19:12:45 -08:00
Saurav Panda 126a420dce fixed cdp error timeout detection in browser closed 2026-02-10 19:04:00 -08:00
Saurav Panda 30dbf9e535 fix: retry select_dropdown when options are lazily populated 2026-02-10 18:50:05 -08:00