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
Match Rust agent class metadata
Magnus Müller0dbecd9aabe2
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.mdindex 3f1b93eaa..4441f7dc4 100644--- a/RUST_AGENT_INTEGRATION_FEATURES.md+++ b/RUST_AGENT_INTEGRATION_FEATURES.md@@ -591,10 +591,15 @@ Terminal core branch: `magnus/browser-use-rust-integration` at terminal main `ee- `_log_action(...)`, `_verify_and_setup_llm()`, `close()`, and `load_and_rerun(...)` no longer expose Rust-only `Any` or return annotations that Browser Use callers would not see.- Proof: `test_rust_agent_unannotated_helper_type_hints_match_browser_use`.+117. Rust Agent class metadata parity+ - The Rust-backed replacement now presents `__module__` as `browser_use.agent.service`, matching Browser Use's public Agent class metadata.+ - This keeps direct imports, top-level imports, `repr(Agent)`, docs, and runtime introspection aligned after the service export redirects to the Rust wrapper.+ - Proof: `test_rust_agent_class_metadata_matches_browser_use_service_surface`.+## 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` (90 tests)+- `uv run pytest -q tests/ci/test_rust_agent.py` (91 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.pyindex 518cecf5b..e0f9f89ad 100644--- a/browser_use/rust/service.py+++ b/browser_use/rust/service.py@@ -2656,3 +2656,6 @@ class Agent(Generic[Context, AgentStructuredOutput]):if isinstance(parsed, dict):events.append(parsed)return events+++Agent.__module__ = 'browser_use.agent.service'diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.pyindex 6cf0ddfad..ea9b0863b 100644--- a/tests/ci/test_rust_agent.py+++ b/tests/ci/test_rust_agent.py@@ -42,6 +42,19 @@ def test_agent_service_export_uses_rust_wrapper():assert ServiceAgent is RustAgent+def test_rust_agent_class_metadata_matches_browser_use_service_surface():+ from browser_use import Agent as TopLevelAgent+ from browser_use.agent.service import Agent as ServiceAgent+ from browser_use.agent.service import _PythonAgent as BrowserUseAgent+ from browser_use.rust import Agent as RustAgent++ assert TopLevelAgent is ServiceAgent is RustAgent+ assert RustAgent.__name__ == BrowserUseAgent.__name__ == 'Agent'+ assert RustAgent.__qualname__ == BrowserUseAgent.__qualname__ == 'Agent'+ assert RustAgent.__module__ == BrowserUseAgent.__module__ == 'browser_use.agent.service'+ assert repr(RustAgent) == repr(BrowserUseAgent)++def test_rust_agent_generic_subscription_matches_browser_use():from browser_use.agent.service import Agent as ServiceAgentfrom browser_use.agent.service import _PythonAgent as BrowserUseAgent