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 error in state if error ends with \n
Magnus Müllera47ea601fad9
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.pyindex 2e7c3b856..2573ba18d 100644--- a/browser_use/agent/message_manager/service.py+++ b/browser_use/agent/message_manager/service.py@@ -124,6 +124,10 @@ class MessageManager:msg = HumanMessage(content='Action result: ' + str(r.extracted_content))self._add_message_with_tokens(msg)if r.error:+ # if endswith \n, remove it+ if r.error.endswith('\n'):+ r.error = r.error[:-1]+ # get only last line of errorlast_line = r.error.split('\n')[-1]msg = HumanMessage(content='Action error: ' + last_line)self._add_message_with_tokens(msg)