TruGenSession via @session.on() or on a TruGenRunner via @runner.on_event(). Both accept either a TruGenEvent enum value or a string event name.
Enum-based events (TruGenEvent)
state: TruGenState
Fired when the session state changes (e.g., to
CONNECTED, DISCONNECTED).void
Fired when the WebRTC connection is successfully established.
reason: DisconnectReason
Fired when the session room disconnects.
track: RemoteVideoTrack
Fired when the remote video track from the avatar is subscribed.
track: RemoteAudioTrack
Fired when the remote audio track from the avatar is subscribed.
void
Fired when the local microphone audio stream begins publishing.
void
Fired when the avatar starts speaking.
void
Fired when the avatar stops speaking.
void
Fired when the user starts speaking. Useful for showing an active listening indicator.
void
Fired when the user finishes speaking.
text: str
Fired when a real-time transcription / caption chunk is received.
void
Fired when microphone permission is being requested.
void
Fired when microphone permission has been granted.
void
Fired when microphone permission has been denied.
error: Exception
Fired when a session or connection error occurs.
String-based events
Some events don’t have a dedicated enum entry — subscribe by string name instead.text: str
Fired when the user completes a final utterance (the fully committed transcript, not a streaming chunk).
text: str
Fired when the agent completes a final utterance. Use alongside
TEXT_CHUNK_RECEIVED for streaming captions plus finalized transcripts.void
Fired when a transient network reconnection begins.
void
Fired when a network reconnection completes.
(participant, quality)
Fired when a participant’s connection quality changes.
Runner-only decorators
These fire on the main thread and are only available onTruGenRunner:
frame: numpy.ndarray | None
Called with each new BGR video frame (a NumPy array) or
None when no frame is currently available.text: str
Called with each streaming caption chunk as it arrives.
state: TruGenState
Called on every session state transition.