Skip to content

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

Include max steps back in

Magnus Müller3f9b1cb650cf
diff --git a/browser_use/agent/prompts.py b/browser_use/agent/prompts.py
index a7b0739ca..18656dcfc 100644
--- a/browser_use/agent/prompts.py
+++ b/browser_use/agent/prompts.py
@@ -198,7 +198,14 @@ Available tabs:
return browser_state
def _get_agent_state_description(self) -> str:
- step_info_description = ''
+ if self.step_info:
+ step_info_description = f'Step {self.step_info.step_number + 1}. Maximum steps: {self.step_info.max_steps}\n'
+ else:
+ step_info_description = ''
+
+ time_str = datetime.now().strftime('%Y-%m-%d %H:%M')
+ step_info_description += f'Current date and time: {time_str}'
+
time_str = datetime.now().strftime('%Y-%m-%d')
step_info_description += f'Current date: {time_str}'