Events
Events are typed objects that flow through the graph. They represent everything that happens in the system, from a user saying “Hello” to an agent deciding to call a function.
Flow
Understanding how events move is key to understanding Atoms:
- Transport Layer: Receives WebSocket message → Converts to
SDKEvent. - Session: Routes event to Root Nodes.
- Nodes: Process event → Emit new events to Children.
- Sink: Catches output events → Converts to WebSocket message → Sends to Client.
Structure
All events inherit from SDKEvent, which is a Pydantic model (TypedModel). This ensures type safety and easy serialization.
Common Events
Custom Events
Signaling between agents
While standard system events handle core mechanics like text and audio, you often need to signal custom business logic states—like PaymentFailed or EscalationRequired.
Why Custom Events? Unlike passing untyped dictionaries, defining SDKEvent subclasses gives you type safety, validation, and clearer intent in your code.
Implementation
Best Practices
Enforce type safety (Pydantic)
Because every event is a Pydantic model, you can trust event.content exists if isinstance checks pass.
Don't break the chain
If your node receives an event it doesn’t understand, it must still pass it on. If you forget send_event(), the stream dies at your node.
Use unique event types
When defining custom events, use a namespaced type string like myapp.order.created to avoid collisions with future system events.

