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
Merge branch 'staging' into feature/infrastructure
Gregor Žuničad0db053b7a9
diff --cc browser_use/agent/service.pyindex 0fd438f18,1e5908d2e..5adef4379--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@@ -132,9 -120,10 +139,10 @@@ class Agent"""Execute one step of the task"""logger.info(f'\n📍 Step {self.n_steps}')state = None+ model_output = Nonetry:- state = await self.controller.browser.get_state(use_vision=self.use_vision)+ state = await self.browser_context.get_state(use_vision=self.use_vision)self.message_manager.add_state_message(state, self._last_result)input_messages = self.message_manager.get_messages()model_output = await self.get_next_action(input_messages)@@@ -345,9 -331,14 +353,14 @@@f' example: {{"is_valid": false, "reason": "The user wanted to search for "cat photos", but the agent searched for "dog photos" instead."}}')- if self.controller.browser.session:- state = self.controller.browser.session.cached_state+ if self.browser_context.session:+ state = self.browser_context.session.cached_state- content = AgentMessagePrompt(state=state, result=self._last_result)+ content = AgentMessagePrompt(+ state=state,+ result=self._last_result,+ include_attributes=self.include_attributes,+ max_error_length=self.max_error_length,+ )msg = [SystemMessage(content=system_msg), content.get_user_message()]else:# if no browser session, we can't validate the output