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 single-step status parity
Magnus Müllerb476203c00c1
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.mdindex 6d349e3fd..197c5cd3e 100644--- a/RUST_AGENT_INTEGRATION_FEATURES.md+++ b/RUST_AGENT_INTEGRATION_FEATURES.md@@ -911,10 +911,15 @@ Terminal core branch: `magnus/browser-use-rust-main-integration` at terminal mai- The log includes the follow-up run's resolved max-step budget, matching the run-start debug metadata emitted by normal terminal-backed runs.- Proof: `test_rust_agent_run_follow_up_logs_main_execution_start`.+180. Rust Agent single-step non-final status parity+ - Terminal-backed `Agent.take_step()` now returns Browser Use's `(False, False)` status for non-final single-step results, even when the reconstructed Rust history has no process errors.+ - Completed single-step results continue to return `(True, True)`, matching Browser Use's done-step contract.+ - Proof: `test_rust_agent_take_step_matches_browser_use_non_final_status`.+## 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` (151 tests)+- `uv run pytest -q tests/ci/test_rust_agent.py` (152 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 fa3933361..35c3a5782 100644--- a/browser_use/rust/service.py+++ b/browser_use/rust/service.py@@ -3617,8 +3617,9 @@ class Agent(Generic[Context, AgentStructuredOutput]):if step_info is not None:self.state.n_steps = max(self.state.n_steps, step_info.step_number)history = await self.run(max_steps=1)- is_valid = not history.has_errors()- return history.is_done(), is_valid+ if history.is_done():+ return True, True+ return False, Falseasync def _execute_step(self,diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.pyindex 179097cfc..ec384697c 100644--- a/tests/ci/test_rust_agent.py+++ b/tests/ci/test_rust_agent.py@@ -4676,6 +4676,32 @@ async def test_rust_agent_take_step_runs_one_terminal_turn():assert is_valid is True+async def test_rust_agent_take_step_matches_browser_use_non_final_status():+ from browser_use.rust import Agent++ agent = Agent(task='step once without finishing')+ seen = []++ class NonFinalHistory:+ def is_done(self):+ return False++ def has_errors(self):+ return False++ async def fake_run(max_steps=100, on_step_start=None, on_step_end=None):+ seen.append(max_steps)+ return NonFinalHistory()++ agent.run = fake_run++ is_done, is_valid = await agent.take_step()++ assert seen == [1]+ assert is_done is False+ assert is_valid is False++async def test_rust_agent_step_runs_single_terminal_turn_and_updates_state(monkeypatch):from browser_use.rust import Agent