Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Log Rust constructor setup summary
Magnus Müller5b12cdd747a3
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.mdindex cd124d6e9..5ab026b35 100644--- a/RUST_AGENT_INTEGRATION_FEATURES.md+++ b/RUST_AGENT_INTEGRATION_FEATURES.md@@ -1061,10 +1061,15 @@ Terminal core branch: `magnus/browser-use-rust-main-integration` at terminal mai- Vision disabling behavior is unchanged; this aligns the public constructor feedback seen by callers when their requested model family does not support vision.- Proof: `test_rust_agent_unsupported_vision_warnings_match_browser_use`.+210. Rust Agent constructor setup debug parity+ - Rust-backed construction now emits Browser Use's module-level setup debug summary after LLM/action setup, including vision mode, extraction model, and file-system availability.+ - This preserves the constructor diagnostics Browser Use callers see before the Rust terminal core is invoked.+ - Proof: `test_rust_agent_constructor_debug_summary_matches_browser_use`.+## Current Verification- `python3 -m py_compile browser_use/agent/service.py 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` (178 tests)+- `uv run pytest -q tests/ci/test_rust_agent.py` (179 tests)- `cargo build -q -p browser-use-cli` on terminal branch `magnus/browser-use-rust-main-integration`- `cargo test -q -p browser-use-cli run_codex_session_command_accepts_task_id_and_model -- --nocapture`- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-agent selected_remote_cdp_mode_allows_remote_cdp_connect -- --nocapture`diff --git a/browser_use/rust/service.py b/browser_use/rust/service.pyindex 0c92e6189..0d2662900 100644--- a/browser_use/rust/service.py+++ b/browser_use/rust/service.py@@ -2604,6 +2604,11 @@ class Agent(Generic[Context, AgentStructuredOutput]):if 'grok' in model_name:self.logger.warning('⚠️ XAI models do not support use_vision=True yet. Setting use_vision=False for now...')self.settings.use_vision = False+ logger.debug(+ f'{" +vision" if self.settings.use_vision else ""}'+ f' extraction_model={getattr(self.settings.page_extraction_llm, "model", "Unknown") if self.settings.page_extraction_llm else "Unknown"}'+ f'{" +file_system" if self.file_system else ""}'+ )self.token_cost_service = TokenCost(include_cost=calculate_cost)_register_llm_for_usage(self.token_cost_service, llm)_register_llm_for_usage(self.token_cost_service, page_extraction_llm)diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.pyindex 89d4e0c13..34e8e9adb 100644--- a/tests/ci/test_rust_agent.py+++ b/tests/ci/test_rust_agent.py@@ -2873,6 +2873,39 @@ def test_rust_agent_unsupported_vision_warnings_match_browser_use(monkeypatch):assert rust_logger.warnings == browser_use_logger.warnings+def test_rust_agent_constructor_debug_summary_matches_browser_use(monkeypatch):+ import browser_use.agent.service as agent_service+ import browser_use.rust.service as rust_service+ from browser_use.agent.service import _PythonAgent as BrowserUseAgent+ from browser_use.rust import Agent as RustAgent++ class LLM:+ model = 'gpt-test'+ provider = 'test'++ async def ainvoke(self, messages, output_format=None, **kwargs):+ return type('Result', (), {'usage': None})()++ class RecordingModuleLogger:+ def __init__(self):+ self.debugs = []++ def debug(self, message, *args, **kwargs):+ self.debugs.append(message)++ browser_use_logger = RecordingModuleLogger()+ rust_logger = RecordingModuleLogger()+ monkeypatch.setattr(agent_service, 'logger', browser_use_logger)+ monkeypatch.setattr(rust_service, 'logger', rust_logger)++ BrowserUseAgent(task='Inspect constructor setup.', llm=LLM(), directly_open_url=False)+ RustAgent(task='Inspect constructor setup.', llm=LLM(), directly_open_url=False)++ expected = ' +vision extraction_model=gpt-test +file_system'+ assert browser_use_logger.debugs[-1] == expected+ assert rust_logger.debugs[-1] == expected++def test_rust_agent_state_id_defaults_like_browser_use():from browser_use.agent.service import _PythonAgent as BrowserUseAgentfrom browser_use.agent.views import AgentState