Skip to content

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

fix take step

Magnus Müller6eed723311e0
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 4fa3af0a4..a12636f1d 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -1312,7 +1312,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):
Returns:
Tuple[bool, bool]: (is_done, is_valid)
"""
- if len(self.history.history) == 0:
+ if step_info is not None and step_info.step_number == 1:
# First step
self._log_first_step_startup()
await self._execute_initial_actions()