Skip to content

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

remove set_use_cloud_from_env

Saurav Panda303be1175897
diff --git a/browser_use/browser/profile.py b/browser_use/browser/profile.py
index 00e69e0e1..513770424 100644
--- a/browser_use/browser/profile.py
+++ b/browser_use/browser/profile.py
@@ -1,4 +1,3 @@
-import os
import sys
import tempfile
from collections.abc import Iterable
@@ -733,15 +732,6 @@ 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()