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
Throw error if we can not connect in the agent
Magnus Müller5ab7ccd414ce
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex a9cc4a38d..a518b6fc3 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -1229,10 +1229,13 @@ class Agent(Generic[Context, AgentStructuredOutput]):# Start browser session and attach watchdogsassert self.browser_session is not None, 'Browser session must be initialized before starting'self.logger.debug('🌐 Starting browser session...')+from browser_use.browser.events import BrowserStartEventevent = self.browser_session.event_bus.dispatch(BrowserStartEvent())await event+ # Check if browser startup actually succeeded by getting the result+ await event.event_result(raise_if_any=True, raise_if_none=False)self.logger.debug('🔧 Browser session started with watchdogs attached')