Skip to content

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

Bridge Rust agent browser mode env

Magnus Müller3b703e276f9d
diff --git a/browser_use/rust/service.py b/browser_use/rust/service.py
index 3253e0679..e504d347f 100644
--- a/browser_use/rust/service.py
+++ b/browser_use/rust/service.py
@@ -401,7 +401,7 @@ class Agent(Generic[AgentStructuredOutput]):
def _browser_mode(self) -> str:
if _extract_cdp_url(self.browser_session):
- return 'managed-headless'
+ return 'remote-cdp'
value = os.environ.get('BROWSER_USE_RUST_BROWSER_MODE')
if value:
return value
@@ -411,6 +411,7 @@ class Agent(Generic[AgentStructuredOutput]):
def _run_env(self) -> dict[str, str]:
env = os.environ.copy()
+ env['LLM_BROWSER_BROWSER_MODE'] = self._browser_mode()
cdp_url = _extract_cdp_url(self.browser_session)
if cdp_url:
env['BU_CDP_URL'] = cdp_url
diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.py
index 9e727477a..8bf6aa873 100644
--- a/tests/ci/test_rust_agent.py
+++ b/tests/ci/test_rust_agent.py
@@ -90,9 +90,10 @@ def test_rust_agent_translates_browser_use_args_to_terminal(monkeypatch):
assert argv[-4:] == ['run-codex', agent.task, '--model', 'gpt-test']
assert '-c' in argv
assert 'max_turns=12' in argv
- assert 'browser_mode="managed-headless"' in argv
+ assert 'browser_mode="remote-cdp"' in argv
assert "First navigate to 'https://example.com'" in agent.task
assert env['BU_CDP_URL'] == 'wss://browser.example/devtools/browser/1'
+ assert env['LLM_BROWSER_BROWSER_MODE'] == 'remote-cdp'
def test_rust_agent_default_codex_model_matches_chatgpt_account(monkeypatch):