Skip to content

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

fix: replace hyphens with underscores in EventBus name generation

naaa7607173d196d2b8
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 2a46efc12..051a016e8 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -604,7 +604,9 @@ class Agent(Generic[Context, AgentStructuredOutput]):
self._message_manager.add_new_task(new_task)
# Mark as follow-up task and recreate eventbus (gets shut down after each run)
self.state.follow_up_task = True
- self.eventbus = EventBus(name=f'Agent_{str(self.id)[-self.state.n_steps :]}')
+
+ agent_id_suffix = str(self.id)[-self.state.n_steps :].replace('-', '_')
+ self.eventbus = EventBus(name=f'Agent_{agent_id_suffix}')
# Re-register cloud sync handler if it exists (if not disabled)
if hasattr(self, 'cloud_sync') and self.cloud_sync and self.enable_cloud_sync: