Skip to content

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

added proxy, profile and timeout

Gregor Žunič02a173f69170
diff --git a/browser_use/remote_execute/remote.py b/browser_use/remote_execute/remote.py
index 91855136d..938b84f56 100644
--- a/browser_use/remote_execute/remote.py
+++ b/browser_use/remote_execute/remote.py
@@ -197,6 +197,9 @@ def _extract_all_params(func: Callable, args: tuple, kwargs: dict) -> dict[str,
def remote_execute(
BROWSER_USE_API_KEY: str | None = None,
+ cloud_profile_id: str | None = None,
+ cloud_proxy_country_code: str | None = None,
+ cloud_timeout: int | None = None,
server_url: str | None = None,
log_level: str = 'INFO',
quiet: bool = False,
@@ -217,7 +220,10 @@ def remote_execute(
Args:
BROWSER_USE_API_KEY: API key (defaults to BROWSER_USE_API_KEY env var)
- server_url: Remote server URL (defaults to https://remote.api.browser-use.com)
+ cloud_profile_id: The ID of the profile to use for the browser session
+ cloud_proxy_country_code: Country code for proxy location (e.g., 'us', 'uk', 'fr')
+ cloud_timeout: The timeout for the browser session in minutes (max 240 = 4 hours)
+ server_url: Remote server URL (defaults to https://remote.api.browser-use.com/remote-execute-stream)
log_level: Logging level (INFO, DEBUG, WARNING, ERROR)
quiet: Suppress console output
headers: Additional HTTP headers to send with the request
@@ -237,6 +243,11 @@ def remote_execute(
# Call with:
result = await task(url="https://example.com", max_steps=10)
+
+ # With cloud parameters:
+ @remote_execute(cloud_proxy_country_code='us', cloud_timeout=60)
+ async def task_with_proxy(browser: Browser) -> str:
+ ...
"""
def decorator(func: Callable[..., Coroutine[Any, Any, T]]) -> Callable[..., Coroutine[Any, Any, T]]:
@@ -324,6 +335,14 @@ async def run(browser):
combined_env['LOG_LEVEL'] = log_level.upper()
payload['env'] = combined_env
+ # Add cloud parameters if provided
+ if cloud_profile_id is not None:
+ payload['cloud_profile_id'] = cloud_profile_id
+ if cloud_proxy_country_code is not None:
+ payload['cloud_proxy_country_code'] = cloud_proxy_country_code
+ if cloud_timeout is not None:
+ payload['cloud_timeout'] = cloud_timeout
+
url = server_url or 'https://remote.api.browser-use.com/remote-execute-stream'
request_headers = {'X-API-Key': api_key}
diff --git a/examples/remote_execution.py b/examples/remote_execution.py
index b095e16c7..dc3a471c8 100644
--- a/examples/remote_execution.py
+++ b/examples/remote_execution.py
@@ -25,10 +25,17 @@ def on_browser_ready(data):
print(' Click the link above to watch the AI agent work!\n')
-@remote_execute(log_level='INFO', on_browser_created=on_browser_ready)
+@remote_execute(
+ log_level='INFO',
+ on_browser_created=on_browser_ready,
+ # server_url='http://localhost:8080/remote-execute-stream',
+ # cloud_profile_id='21182245-590f-4712-8888-9611651a024c',
+ cloud_proxy_country_code='us',
+ # cloud_timeout=60,
+)
async def pydantic_example(browser: Browser) -> AgentHistoryList:
agent = Agent(
- """got of to https://news.ycombinator.com/ and find the latest top 5 news and each top comment""",
+ """go and check my ip address and the location. return the result in json format""",
browser=browser,
# output_model_schema=HackernewsPosts,
llm=ChatBrowserUse(),