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
Increase consecutive_failures if action error
Magnus Müller5a908851d5ae
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex becaeca4a..144cb804d 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -798,6 +798,12 @@ class Agent(Generic[Context, AgentStructuredOutput]):# Check for new downloads after executing actionsawait self._check_and_update_downloads('after executing actions')+ # check for action errors+ if self.state.last_result and self.state.last_result[-1].error:+ self.state.consecutive_failures += 1+ self.logger.debug(f'🔄 Step {self.state.n_steps}: Consecutive failures: {self.state.consecutive_failures}')+ return+self.state.consecutive_failures = 0self.logger.debug(f'🔄 Step {self.state.n_steps}: Consecutive failures reset to: {self.state.consecutive_failures}')