Skip to content

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

Bridge BrowserProfile devtools

Magnus Müllerfdd510dcdc27
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.md
index 453e43cc3..0af46eeaf 100644
--- a/RUST_AGENT_INTEGRATION_FEATURES.md
+++ b/RUST_AGENT_INTEGRATION_FEATURES.md
@@ -150,10 +150,15 @@ Terminal core branch: `magnus/browser-use-rust-integration` at latest pulled mai
- Dict-style and tuple-style position values are accepted by the Rust-backed wrapper.
- Proof: `test_rust_agent_translates_browser_profile_window_position`.
+29. BrowserProfile devtools bridge
+ - `BrowserProfile(devtools=True)` is serialized into `--auto-open-devtools-for-tabs` for terminal managed Chromium runs.
+ - This preserves Browser Use's headed-browser devtools launch option through the Rust managed browser path.
+ - Proof: `test_rust_agent_translates_browser_profile_devtools`.
+
## Current Verification
- `python3 -m py_compile browser_use/rust/service.py browser_use/rust/__init__.py browser_use/__init__.py tests/ci/test_rust_agent.py examples/rust_agent/basic.py examples/rust_agent/real_v8_smoke.py`
-- `uv run pytest -q tests/ci/test_rust_agent.py` (38 tests)
+- `uv run pytest -q tests/ci/test_rust_agent.py` (39 tests)
- `cargo build -q -p browser-use-cli`
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-agent selected_remote_cdp_mode_allows_remote_cdp_connect -- --nocapture`
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-agent bare_browser_connect_resolves_to_selected_managed_mode_with_launch_args -- --nocapture`
diff --git a/browser_use/rust/service.py b/browser_use/rust/service.py
index 3574d7765..c3eed119e 100644
--- a/browser_use/rust/service.py
+++ b/browser_use/rust/service.py
@@ -169,6 +169,8 @@ def _managed_browser_launch_args(browser_session: BrowserSession | None, browser
if getattr(profile, 'chromium_sandbox', None) is False:
for arg in CHROME_DOCKER_ARGS:
_append_unique(args, seen, arg)
+ if getattr(profile, 'devtools', False) is True:
+ _append_unique(args, seen, '--auto-open-devtools-for-tabs')
_append_unique(args, seen, _window_size_arg(getattr(profile, 'window_size', None)))
_append_unique(args, seen, _window_position_arg(getattr(profile, 'window_position', None)))
proxy = getattr(profile, 'proxy', None)
diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.py
index ff762ec7f..fda453f77 100644
--- a/tests/ci/test_rust_agent.py
+++ b/tests/ci/test_rust_agent.py
@@ -310,6 +310,25 @@ def test_rust_agent_translates_browser_profile_window_position(monkeypatch):
assert '--window-position=12,24' in json.loads(tuple_agent._run_env()['BU_MANAGED_BROWSER_ARGS'])
+def test_rust_agent_translates_browser_profile_devtools(monkeypatch):
+ from browser_use.rust import Agent
+
+ class BrowserProfile:
+ headless = False
+ devtools = True
+
+ monkeypatch.setenv('BROWSER_USE_TERMINAL_BINARY', '/tmp/browser-use-terminal')
+ monkeypatch.delenv('BROWSER_USE_RUST_BROWSER_MODE', raising=False)
+ monkeypatch.delenv('BROWSER_USE_BROWSER_MODE', raising=False)
+
+ agent = Agent(task='report title', browser_profile=BrowserProfile())
+ env = agent._run_env()
+ launch_args = json.loads(env['BU_MANAGED_BROWSER_ARGS'])
+
+ assert env['LLM_BROWSER_BROWSER_MODE'] == 'managed-headed'
+ assert '--auto-open-devtools-for-tabs' in launch_args
+
+
def test_rust_agent_translates_browser_profile_user_data_dir(monkeypatch, tmp_path):
from browser_use.rust import Agent