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
fix: unify CLI cloud auth so cloud connect uses ~/.browser-use/config.json
ShawnPanaae93cee5c22e
diff --git a/browser_use/skill_cli/commands/cloud.py b/browser_use/skill_cli/commands/cloud.pyindex e695186d4..2c6df8a6f 100644--- a/browser_use/skill_cli/commands/cloud.py+++ b/browser_use/skill_cli/commands/cloud.py@@ -69,14 +69,18 @@ def _write_config(data: dict) -> None:pass-def _get_api_key() -> str:- """Return API key from env var or config file. Exits with error if missing."""+def _get_api_key_or_none() -> str | None:+ """Return API key from env var or CLI config file, or None if not found."""key = os.environ.get('BROWSER_USE_API_KEY')if key:return key-config = _read_config()- key = config.get('api_key')+ return config.get('api_key')+++def _get_api_key() -> str:+ """Return API key from env var or config file. Exits with error if missing."""+ key = _get_api_key_or_none()if key:return keydiff --git a/browser_use/skill_cli/main.py b/browser_use/skill_cli/main.pyindex dfb181795..88f6780df 100755--- a/browser_use/skill_cli/main.py+++ b/browser_use/skill_cli/main.py@@ -307,6 +307,16 @@ def ensure_daemon(# Set up environmentenv = os.environ.copy()+ # For cloud mode, ensure the daemon has the API key from CLI config (~/.browser-use/config.json).+ # CloudBrowserClient checks BROWSER_USE_API_KEY env var first, so injecting it here+ # prevents the library from falling back to ~/.config/browseruse/cloud_auth.json.+ if use_cloud and 'BROWSER_USE_API_KEY' not in env:+ from browser_use.skill_cli.commands.cloud import _get_api_key_or_none++ cli_api_key = _get_api_key_or_none()+ if cli_api_key:+ env['BROWSER_USE_API_KEY'] = cli_api_key+# Start daemon as background processif sys.platform == 'win32':subprocess.Popen(