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
Update action result handling in service.py to include extracted content in memory for paused agent states and SERPER API key checks, enhancing error reporting consistency.
Magnus Müllerc62d14d9edd2
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 54b315182..ee4867fab 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -1037,14 +1037,14 @@ class Agent(Generic[Context]):# self.logger.debug('Agent paused')self.state.last_result = [ActionResult(- error='The agent was paused mid-step - the last action might need to be repeated', include_in_memory=False+ error='The agent was paused mid-step - the last action might need to be repeated', include_in_memory=True)]returnexcept asyncio.CancelledError:# Directly handle the case where the step is cancelled at a higher level# self.logger.debug('Task cancelled - agent was paused with Ctrl+C')- self.state.last_result = [ActionResult(error='The agent was paused with Ctrl+C', include_in_memory=False)]+ self.state.last_result = [ActionResult(error='The agent was paused with Ctrl+C', include_in_memory=True)]raise InterruptedError('Step cancelled by user')except Exception as e:result = await self._handle_step_error(e)@@ -1090,7 +1090,7 @@ class Agent(Generic[Context]):if 'Browser closed' in error_msg:self.logger.error('❌ Browser is closed or disconnected, unable to proceed')- return [ActionResult(error='Browser closed or disconnected, unable to proceed', include_in_memory=False)]+ return [ActionResult(error='Browser closed or disconnected, unable to proceed', include_in_memory=True)]if isinstance(error, (ValidationError, ValueError)):self.logger.error(f'{prefix}{error_msg}')diff --git a/eval/service.py b/eval/service.pyindex 3ef4aff28..800f64f21 100644--- a/eval/service.py+++ b/eval/service.py@@ -443,7 +443,7 @@ def create_controller_with_serp_search():async def search_web(query: str):"""Search the web using Serper API"""if not SERPER_API_KEY:- return ActionResult(extracted_content='Search unavailable: SERPER_API_KEY not configured', include_in_memory=False)+ return ActionResult(extracted_content='Search unavailable: SERPER_API_KEY not configured', include_in_memory=True)try:# Make request to Serper API