Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
extract CLI deps to requirements-cli.txt + add CI test
ShawnPana2f41a42eabfa
diff --git a/browser_use/skill_cli/install_lite.sh b/browser_use/skill_cli/install_lite.shindex 42a77116e..0fab80210 100755--- a/browser_use/skill_cli/install_lite.sh+++ b/browser_use/skill_cli/install_lite.sh@@ -280,22 +280,14 @@ install_browser_use() {local tmp_dir=$(mktemp -d)git clone --depth 1 --branch "$BROWSER_USE_BRANCH" "https://github.com/$BROWSER_USE_REPO.git" "$tmp_dir"uv pip install "$tmp_dir" --no-deps- rm -rf "$tmp_dir"# Install only the dependencies the CLI actually needs (~10 packages).+ # The list lives in requirements-cli.txt so it's discoverable and testable.# Transitive deps (e.g. websockets via cdp-use) are resolved automatically.log_info "Installing minimal CLI dependencies..."- uv pip install \- "aiohttp==3.13.3" \- "bubus==1.5.6" \- "cdp-use==1.4.5" \- "httpx==0.28.1" \- "psutil==7.2.2" \- "pydantic==2.12.5" \- "pydantic-settings==2.12.0" \- "python-dotenv==1.2.1" \- "typing-extensions==4.15.0" \- "uuid7==0.1.0"+ uv pip install -r "$tmp_dir/browser_use/skill_cli/requirements-cli.txt"++ rm -rf "$tmp_dir"log_success "browser-use CLI installed (lightweight)"}diff --git a/browser_use/skill_cli/requirements-cli.txt b/browser_use/skill_cli/requirements-cli.txtnew file mode 100644index 000000000..52fd804e7--- /dev/null+++ b/browser_use/skill_cli/requirements-cli.txt@@ -0,0 +1,12 @@+# Minimal dependencies for the browser-use CLI.+# Used by install_lite.sh — update this file if the CLI's import chain changes.+aiohttp==3.13.3+bubus==1.5.6+cdp-use==1.4.5+httpx==0.28.1+psutil==7.2.2+pydantic==2.12.5+pydantic-settings==2.12.0+python-dotenv==1.2.1+typing-extensions==4.15.0+uuid7==0.1.0diff --git a/tests/ci/test_cli_lite_deps.py b/tests/ci/test_cli_lite_deps.pynew file mode 100644index 000000000..7b448cf04--- /dev/null+++ b/tests/ci/test_cli_lite_deps.py@@ -0,0 +1,90 @@+"""Test that the CLI boots with only the minimal deps from requirements-cli.txt.++Creates a temp venv, installs browser-use with --no-deps, installs only the+requirements-cli.txt deps, then verifies the CLI's critical import paths work.+If this test fails, someone added a new import to the CLI path without updating+browser_use/skill_cli/requirements-cli.txt.+"""++import subprocess+import sys+import tempfile+from pathlib import Path++import pytest++# Path to the repo root (two levels up from tests/ci/)+REPO_ROOT = Path(__file__).parent.parent.parent+REQUIREMENTS_CLI = REPO_ROOT / 'browser_use' / 'skill_cli' / 'requirements-cli.txt'++[email protected](scope='module')+def lite_venv():+ """Create a temp venv with only CLI deps installed."""+ with tempfile.TemporaryDirectory() as tmp:+ venv_dir = Path(tmp) / 'venv'++ # Create venv+ result = subprocess.run(+ ['uv', 'venv', str(venv_dir), '--python', sys.executable],+ capture_output=True,+ text=True,+ )+ assert result.returncode == 0, f'Failed to create venv: {result.stderr}'++ # Get the python binary in the venv+ python = venv_dir / 'bin' / 'python'+ if not python.exists():+ python = venv_dir / 'Scripts' / 'python.exe' # Windows++ # Install browser-use without deps+ result = subprocess.run(+ ['uv', 'pip', 'install', str(REPO_ROOT), '--no-deps', '--python', str(python)],+ capture_output=True,+ text=True,+ )+ assert result.returncode == 0, f'Failed to install browser-use: {result.stderr}'++ # Install only CLI requirements+ result = subprocess.run(+ ['uv', 'pip', 'install', '-r', str(REQUIREMENTS_CLI), '--python', str(python)],+ capture_output=True,+ text=True,+ )+ assert result.returncode == 0, f'Failed to install CLI deps: {result.stderr}'++ yield python+++def _import_check(python: Path, import_stmt: str) -> subprocess.CompletedProcess:+ """Run an import statement in the lite venv and return the result."""+ return subprocess.run(+ [str(python), '-c', import_stmt],+ capture_output=True,+ text=True,+ timeout=30,+ )+++def test_cli_entry_point(lite_venv):+ """The CLI entry point must run --help with only CLI deps."""+ result = subprocess.run(+ [str(lite_venv), '-m', 'browser_use.skill_cli.main', '--help'],+ capture_output=True,+ text=True,+ timeout=30,+ )+ assert result.returncode == 0, f'CLI --help failed:\n{result.stderr}'+ assert 'browser-use' in result.stdout.lower() or 'browser automation' in result.stdout.lower()+++def test_daemon_imports(lite_venv):+ """The daemon module must import with only CLI deps."""+ result = _import_check(lite_venv, 'from browser_use.skill_cli.daemon import main')+ assert result.returncode == 0, f'daemon import failed:\n{result.stderr}'+++def test_browser_session_imports(lite_venv):+ """BrowserSession must import with only CLI deps."""+ result = _import_check(lite_venv, 'from browser_use.browser.session import BrowserSession')+ assert result.returncode == 0, f'BrowserSession import failed:\n{result.stderr}'