Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

clear agent eventbus, not just browser session's

Laith Weinbergerbe6873636e3b
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index c1a39e615..f1b560f77 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -2354,7 +2354,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):
# Stop the event bus gracefully, waiting for all events to be processed
# Configurable via TIMEOUT_AgentEventBusStop env var (default: 3.0s)
- await self.eventbus.stop(timeout=_get_timeout('TIMEOUT_AgentEventBusStop', 3.0))
+ await self.eventbus.stop(clear=True, timeout=_get_timeout('TIMEOUT_AgentEventBusStop', 3.0))
await self.close()