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
fix: correct method for adding max steps error to agent history
shyanilMishra2d448ccbc1cb
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 7e364bcf3..305e51f70 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -136,6 +136,7 @@ class Agent(Generic[Context]):self.llm = llmself.controller = controllerself.sensitive_data = sensitive_data+self.settings = AgentSettings(use_vision=use_vision,@@ -567,9 +568,25 @@ class Agent(Generic[Context]):breakelse:error_message = 'Failed to complete task in maximum steps'- self.history.add_error(error_message)++ self.state.history.history.append(+ AgentHistory(+ model_output=None,+ result=[ActionResult(error=error_message, include_in_memory=True)],+ state=BrowserStateHistory(+ url="",+ title="",+ tabs=[],+ interacted_element=[],+ screenshot=None,+ ),+ metadata=None+ )+ )+logger.info(f'❌ {error_message}')+return self.state.historyfinally:self.telemetry.capture(