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 'main' into local-remote-split
Nick Sweeting9f9558e49f30
diff --cc browser_use/agent/service.pyindex 0cecccf15,657290d35..dda837ec5--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@@ -700,20 -710,12 +700,20 @@@ class Agent(Generic[Context, AgentStrucassert self.browser_session is not None, 'BrowserSession is not set up'self.logger.debug(f'🌐 Step {self.state.n_steps}: Getting browser state...')- # Capture screenshots if needed for either vision (LLM input) or GIF generation- should_capture_screenshot = self.settings.use_vision or bool(self.settings.generate_gif)- browser_state_summary = await self.browser_session.get_browser_state_with_recovery(- cache_clickable_elements_hashes=True, include_screenshot=should_capture_screenshot- )- current_page = await self.browser_session.get_current_page()+ # Always take screenshots for all steps+ # Use caching based on preload setting - if preload is False, don't use cached state+ use_cache = self.preload+ self.logger.debug(f'📸 Requesting browser state with include_screenshot=True, cached={use_cache}')+ browser_state_summary = await self.browser_session.get_browser_state_summary(+ cache_clickable_elements_hashes=True,- include_screenshot=True,++ include_screenshot=True, # always capture even if use_vision=False so that cloud sync is useful (it's fast now anyway)+ cached=use_cache,+ include_recent_events=self.include_recent_events,- )++ )+ if browser_state_summary.screenshot:+ self.logger.debug(f'📸 Got browser state WITH screenshot, length: {len(browser_state_summary.screenshot)}')+ else:+ self.logger.debug('📸 Got browser state WITHOUT screenshot')# Check for new downloads after getting browser state (catches PDF auto-downloads and previous step downloads)await self._check_and_update_downloads(f'Step {self.state.n_steps}: after getting browser state')