Skip to content

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

refc: made use_cloud false by default and added live_url to info

Saurav Panda4659f60c29dc
diff --git a/browser_use/browser/cloud.py b/browser_use/browser/cloud.py
index 74f2c52f5..b5d66998f 100644
--- a/browser_use/browser/cloud.py
+++ b/browser_use/browser/cloud.py
@@ -110,7 +110,8 @@ class CloudBrowserClient:
logger.info(f'🌤️ Cloud browser created successfully: {browser_response.id}')
logger.debug(f'🌤️ CDP URL: {browser_response.cdpUrl}')
- logger.debug(f'🌤️ Live URL: {browser_response.liveUrl}')
+ # Cyan color for live URL
+ logger.info(f'\033[36m🔗 Live URL: {browser_response.liveUrl}\033[0m')
return browser_response
diff --git a/browser_use/browser/profile.py b/browser_use/browser/profile.py
index daf7494e8..00e69e0e1 100644
--- a/browser_use/browser/profile.py
+++ b/browser_use/browser/profile.py
@@ -552,7 +552,7 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Bro
cdp_url: str | None = Field(default=None, description='CDP URL for connecting to existing browser instance')
is_local: bool = Field(default=False, description='Whether this is a local browser instance')
use_cloud: bool = Field(
- default_factory=lambda: bool(os.getenv('BROWSER_USE_API_KEY')),
+ default=False,
description='Use browser-use cloud browser service instead of local browser',
)
@@ -733,6 +733,15 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Bro
logger.warning('BrowserProfile.proxy.bypass provided but proxy has no server; bypass will be ignored.')
return self
+ @model_validator(mode='after')
+ def set_use_cloud_from_env(self) -> Self:
+ """Set use_cloud=True if BROWSER_USE_API_KEY environment variable is present and use_cloud wasn't explicitly set."""
+ # Only auto-enable if use_cloud is still the default (False) and API key is present
+ if not self.use_cloud and bool(os.getenv('BROWSER_USE_API_KEY')):
+ self.use_cloud = True
+ logger.debug('🌤️ Auto-enabled cloud browser due to BROWSER_USE_API_KEY environment variable')
+ return self
+
def model_post_init(self, __context: Any) -> None:
"""Called after model initialization to set up display configuration."""
self.detect_display_configuration()
diff --git a/docs/customize/browser/remote.mdx b/docs/customize/browser/remote.mdx
index e379115ca..f29677847 100644
--- a/docs/customize/browser/remote.mdx
+++ b/docs/customize/browser/remote.mdx
@@ -5,9 +5,8 @@ icon: "cloud"
mode: "wide"
---
-## Get a CDP URL
-### Browser-Use Cloud Browser
+### Browser-Use Cloud Browser or CDP URL
The easiest way to use a cloud browser is with the built-in Browser-Use cloud service: