The SDK provides two mechanisms for handling events: decorator-based handlers for discrete events, and async iterators for continuous audio streams.
Use decorators for discrete, one-time events:
Client-level events are registered on the AgenTaoClient instance and fire for any call.
Call-level events are registered on a specific ActiveCall instance and fire only for that call.
Use async iterators for continuous audio streams:
The iterator yields audio chunks as they arrive. It terminates when the call ends or the media connection closes.
A typical pattern combines a call-level event with the audio stream:
The public 0.24.0 package docs also mention ClientEvent and CallEvent enums as type-safe alternatives to the string constants in agentao_sdk.events.