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
Enhance error handling in Agent class step execution
Magnus Müller15ec11e76812
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex f5df5fab4..6d6e524c5 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -1223,7 +1223,9 @@ class Agent(Generic[Context, AgentStructuredOutput]):except TimeoutError:# Handle step timeout gracefullyerror_msg = f'Step {step + 1} timed out after 300 seconds'- logger.error(f'⏰ {error_msg}')+ self.logger.error(f'⏰ {error_msg}')+ self.state.consecutive_failures += 1+ self.state.last_result = [ActionResult(error=error_msg, include_in_memory=True)]if on_step_end is not None:await on_step_end(self)