Skip to main content
Subscribe to agent lifecycle and tool events with a typed event bus — zero cost when nothing is listening.
The user runs the agent; tool and lifecycle events publish to subscribers for logging, UI updates, or custom automation.

How It Works

Quick Start

1

Subscribe and publish

2

Global bus with an agent

publish() returns immediately when there are no subscribers — no lock, no UUID, no history. Wrap expensive payload construction in a has_subscribers check.

Event Types


Common Patterns

Async subscriber:
Guard expensive payloads:
Event history:

Best Practices

Building summaries or embeddings for events nobody listens to wastes CPU — guard with bus.has_subscribers.
Pass event_types= to subscribe() so handlers only run for relevant events.
The shared default bus lets agents, memory, and hooks emit events without passing a bus instance everywhere.
Sync callbacks run inline; async handlers are awaited during publish_async only.

Hook Events

Hook lifecycle events alongside the bus

Spawn & Announce

Sub-agent events and coordination