Skip to content

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

fixed prompt voilation of under 10 step instruction

Saurav Panda9b0d2f685ff5
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index abaf23eec..063d8ed72 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -1249,7 +1249,8 @@ class Agent(Generic[Context, AgentStructuredOutput]):
f'BUDGET WARNING: You have used {steps_used}/{step_info.max_steps} steps '
f'({pct}%). {steps_remaining} steps remaining. '
f'If the task cannot be completed in the remaining steps, prioritize: '
- f'(1) save all partial results to files, (2) call done with what you have. '
+ f'(1) consolidate your results (save to files if the file system is in use), '
+ f'(2) call done with what you have. '
f'Partial results are far more valuable than exhausting all steps with nothing saved.'
)
self.logger.info(f'Step budget warning: {steps_used}/{step_info.max_steps} ({pct}%)')
diff --git a/browser_use/agent/system_prompts/system_prompt.md b/browser_use/agent/system_prompts/system_prompt.md
index 18124d4d2..f2e51367b 100644
--- a/browser_use/agent/system_prompts/system_prompt.md
+++ b/browser_use/agent/system_prompts/system_prompt.md
@@ -107,7 +107,7 @@ The `done` action is your opportunity to terminate and share your findings with
- If the user asks for specified format, such as "return JSON with following structure", "return a list of format...", MAKE sure to use the right format in your answer.
- If the user asks for a structured output, your `done` action's schema will be modified. Take this schema into account when solving the task!
- When you reach 75% of your step budget, critically evaluate whether you can complete the full task in the remaining steps.
- If completion is unlikely, shift strategy: save all progress gathered so far to files and focus on the highest-value remaining items.
+ If completion is unlikely, shift strategy: focus on the highest-value remaining items and consolidate your results (save progress to files if the file system is in use).
This ensures that when you do call `done` (at max_steps or earlier), you have meaningful partial results to deliver.
- For large multi-item tasks (e.g. "search 50 items"), estimate the per-item cost from the first few items.
If the task will exceed your budget, prioritize the most important items and save results incrementally.
diff --git a/browser_use/agent/system_prompts/system_prompt_anthropic.md b/browser_use/agent/system_prompts/system_prompt_anthropic.md
index 3c0c6e6ae..40a75f931 100644
--- a/browser_use/agent/system_prompts/system_prompt_anthropic.md
+++ b/browser_use/agent/system_prompts/system_prompt_anthropic.md
@@ -110,7 +110,7 @@ The `done` action is your opportunity to terminate and share your findings with
- If the user asks for specified format, such as "return JSON with following structure", "return a list of format...", MAKE sure to use the right format in your answer.
- If the user asks for a structured output, your `done` action's schema will be modified. Take this schema into account when solving the task!
- When you reach 75% of your step budget, critically evaluate whether you can complete the full task in the remaining steps.
- If completion is unlikely, shift strategy: save all progress gathered so far to files and focus on the highest-value remaining items.
+ If completion is unlikely, shift strategy: focus on the highest-value remaining items and consolidate your results (save progress to files if the file system is in use).
This ensures that when you do call `done` (at max_steps or earlier), you have meaningful partial results to deliver.
- For large multi-item tasks (e.g. "search 50 items"), estimate the per-item cost from the first few items.
If the task will exceed your budget, prioritize the most important items and save results incrementally.
diff --git a/browser_use/agent/system_prompts/system_prompt_anthropic_no_thinking.md b/browser_use/agent/system_prompts/system_prompt_anthropic_no_thinking.md
index b60cbce35..8715d79f8 100644
--- a/browser_use/agent/system_prompts/system_prompt_anthropic_no_thinking.md
+++ b/browser_use/agent/system_prompts/system_prompt_anthropic_no_thinking.md
@@ -110,7 +110,7 @@ The `done` action is your opportunity to terminate and share your findings with
- If the user asks for specified format, such as "return JSON with following structure", "return a list of format...", MAKE sure to use the right format in your answer.
- If the user asks for a structured output, your `done` action's schema will be modified. Take this schema into account when solving the task!
- When you reach 75% of your step budget, critically evaluate whether you can complete the full task in the remaining steps.
- If completion is unlikely, shift strategy: save all progress gathered so far to files and focus on the highest-value remaining items.
+ If completion is unlikely, shift strategy: focus on the highest-value remaining items and consolidate your results (save progress to files if the file system is in use).
This ensures that when you do call `done` (at max_steps or earlier), you have meaningful partial results to deliver.
- For large multi-item tasks (e.g. "search 50 items"), estimate the per-item cost from the first few items.
If the task will exceed your budget, prioritize the most important items and save results incrementally.
diff --git a/tests/ci/test_budget_warning.py b/tests/ci/test_budget_warning.py
index 74727b7ba..b03d49656 100644
--- a/tests/ci/test_budget_warning.py
+++ b/tests/ci/test_budget_warning.py
@@ -151,6 +151,6 @@ async def test_budget_warning_contains_actionable_guidance():
messages = _get_context_messages(agent)
msg = messages[0]
- assert 'save all partial results' in msg.lower()
+ assert 'consolidate your results' in msg.lower()
assert 'done' in msg.lower()
assert 'partial results' in msg.lower()