Skip to content

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

Clarify Rust preloaded page task context

Magnus Müllera789f8d8c886
diff --git a/browser_use/rust/service.py b/browser_use/rust/service.py
index 182e16644..d6be60e57 100644
--- a/browser_use/rust/service.py
+++ b/browser_use/rust/service.py
@@ -1175,7 +1175,8 @@ def _task_with_completed_initial_navigation_context(
cleaned_task = cleaned_task[len(prefix) :]
return (
f'The browser session is already open at {urls[0]!r}. '
- 'Continue from the current page. Do not navigate to that same start URL again unless browser status shows a different URL.'
+ 'Continue from the current page. Your first browser step should inspect the current page state before any repeat navigation. '
+ 'Do not navigate to that same start URL again unless browser status or page_info shows a different URL.'
f'\n\n{cleaned_task}'
)
initial_action_urls: list[str] = []
diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.py
index 0a49948a7..c79147815 100644
--- a/tests/ci/test_rust_agent.py
+++ b/tests/ci/test_rust_agent.py
@@ -7099,6 +7099,7 @@ async def test_rust_agent_run_pre_navigates_cdp_session_before_sdk_by_default():
assert browser_session.calls == [('https://example.com', False)]
assert agent._completed_initial_navigation_urls == ['https://example.com']
assert seen[0].startswith("The browser session is already open at 'https://example.com'")
+ assert 'first browser step should inspect the current page state' in seen[0]
assert "First navigate to 'https://example.com'" not in seen[0]