How Events Work
The Anam SDK uses an event-driven architecture where your application listens for specific events and reacts accordingly. This allows you to:- Update your UI based on connection status
- Track conversation history in real-time
- Handle user interruptions
- Monitor stream quality and performance
Available Events
Connection Events
These events track the connection lifecycle between your client and Anam’s streaming infrastructure:CONNECTION_ESTABLISHED
Fired when the WebRTC connection is successfully established.
SESSION_READY
Fired after the session initializes and all backend components are ready. Use this to remove loading indicators.
CONNECTION_CLOSED
Fired when the connection is terminated. Receives a reason code and optional details.
Video Events
VIDEO_STREAM_STARTED
Fired when the video MediaStream becomes available.
VIDEO_PLAY_STARTED
Fired when the first video frames begin playing. Ideal for removing loading indicators.
Audio Events
AUDIO_STREAM_STARTED
Fired when the audio MediaStream from the persona becomes available.
INPUT_AUDIO_STREAM_STARTED
Fired when microphone input is successfully initialized.
INPUT_AUDIO_DEVICE_CHANGED
Fired when the input audio device changes.
Microphone Permission Events
These events track the state of microphone permission requests:MIC_PERMISSION_PENDING
Fired when the browser is requesting microphone permission from the user.
MIC_PERMISSION_GRANTED
Fired when the user grants microphone permission.
MIC_PERMISSION_DENIED
Fired when the user denies microphone permission.
Conversation Events
These events help you track and respond to conversation flow:MESSAGE_HISTORY_UPDATED
Provides the complete conversation history each time a participant finishes speaking.
MESSAGE_STREAM_EVENT_RECEIVED
Provides real-time transcription updates as speech occurs.
Reasoning Events
These events provide insight into the persona’s reasoning process (when using models that support it):REASONING_HISTORY_UPDATED
Provides the complete reasoning history.
REASONING_STREAM_EVENT_RECEIVED
Provides real-time reasoning updates as the persona thinks.
Talk Stream Events
TALK_STREAM_INTERRUPTED
Fired when a user interrupts a TalkMessageStream by speaking. Receives the correlation ID directly.
Server Events
SERVER_WARNING
Fired when the server sends a warning message.
Client Tool Call Events
CLIENT_TOOL_EVENT_RECEIVED
Fired when the AI persona invokes a client tool, allowing your application to respond to requests for UI actions like navigation, opening modals, or updating state.
Client tools enable voice-driven or chat-driven UI control. For a complete guide on creating and configuring client tools, see the Client Tools Guide.

