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 direct URL startup like Browser Use
Magnus Müller3629709972ec
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.mdindex debfd4290..b1d805a69 100644--- a/RUST_AGENT_INTEGRATION_FEATURES.md+++ b/RUST_AGENT_INTEGRATION_FEATURES.md@@ -1051,10 +1051,15 @@ Terminal core branch: `magnus/browser-use-rust-main-integration` at terminal mai- The `browser` plus `browser_session` conflict now raises Browser Use's public error message instead of the Rust wrapper's shorter old-interface message.- Proof: `test_rust_agent_constructor_aliases_match_browser_use`.+208. Rust Agent direct-URL startup feedback parity+ - Rust-backed construction now logs Browser Use's "Found URL in task" startup message when `directly_open_url=True` converts a task URL into an initial navigation action.+ - This preserves the public feedback callers see when automatic URL startup changes the initial action list before the Rust terminal core runs.+ - Proof: `test_rust_agent_logs_direct_url_startup_like_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` (176 tests)+- `uv run pytest -q tests/ci/test_rust_agent.py` (177 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 c2bbeaf99..0708ad6d4 100644--- a/browser_use/rust/service.py+++ b/browser_use/rust/service.py@@ -2645,6 +2645,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):if self.directly_open_url and not self.state.follow_up_task and not initial_actions:self.initial_url = _extract_start_url(task)if self.initial_url:+ self.logger.info(f'🔗 Found URL in task: {self.initial_url}, adding as initial action...')initial_actions = [{'navigate': {'url': self.initial_url, 'new_tab': False}}]self.initial_action_payloads = list(initial_actions or [])self.initial_actions = self._convert_initial_actions(self.initial_action_payloads) if self.initial_action_payloads else Nonediff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.pyindex 9eccaa61f..dca3fcf59 100644--- a/tests/ci/test_rust_agent.py+++ b/tests/ci/test_rust_agent.py@@ -2544,6 +2544,46 @@ def test_rust_agent_mirrors_direct_url_startup():assert "First navigate to 'https://example.com'" in agent.task+def test_rust_agent_logs_direct_url_startup_like_browser_use(monkeypatch):+ 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 RecordingLogger:+ def __init__(self):+ self.infos = []++ def info(self, message, *args, **kwargs):+ self.infos.append(message)++ def debug(self, message, *args, **kwargs):+ pass++ def warning(self, message, *args, **kwargs):+ pass++ def error(self, message, *args, **kwargs):+ pass++ browser_use_logger = RecordingLogger()+ rust_logger = RecordingLogger()+ monkeypatch.setattr(BrowserUseAgent, 'logger', property(lambda self: browser_use_logger))+ monkeypatch.setattr(RustAgent, 'logger', property(lambda self: rust_logger))++ BrowserUseAgent(task='Open example.com and report the title.', llm=LLM())+ RustAgent(task='Open example.com and report the title.', llm=LLM())++ expected = ['🔗 Found URL in task: https://example.com, adding as initial action...']+ assert browser_use_logger.infos == expected+ assert rust_logger.infos == expected++def test_rust_agent_exposes_task_helper_methods():from browser_use.rust import Agent