Why it matters
Event-based model makes agents debuggable and testable. Understanding events unlocks observability.
Advertisement
The architecture
Event types: user turn, model turn, tool call, tool response, control (session change).
Content: message parts, tool call args, tool results.
Advertisement
How it works end to end
Streaming: events emitted as they happen. UI subscribes and updates.
Persistence: events part of session; persisted with session state.
Callbacks: hook into event lifecycle for custom processing.
Filtering: emit certain events only or transform before sending.