type— the event name.event_id— on commands, an optional UUID you assign (the server generates one if omitted). On response events, a server-generated UUID.source_event_id— response events only. Theevent_idof the command that caused the event, ornullwhen there is none.
Command Events
Send these over the WebSocket.event_id is optional on every command.
Unknown
type, malformed JSON, missing audio, or invalid Base64 return an error event. There is no separate “clear buffer” command; use agent.interrupt.
Utterances
An utterance is a run of audio the avatar speaks as one unit. It is identified by theevent_id of its first agent.speak chunk. Later chunks in the same utterance may carry any event_id; only the first names the utterance. agent.speak_end or agent.interrupt seals it, and the next agent.speak opens a new one.
Every response event caused by an utterance carries that first-chunk event_id as source_event_id. Set one UUID per utterance on the first agent.speak (or on every chunk of it) and match response events by source_event_id to know which utterance the avatar is speaking, has finished, or was interrupted.
Response Events
Listen for these on the WebSocket.session.state_updated states
The state field on session.state_updated is one of:
agent.state_updated states
The previous_state and new_state fields on agent.state_updated are one of:
error types
The error.type field on error is one of:
Connection and liveness
- One WebSocket per session. Opening a new connection replaces the existing one.
- Send
session.keep_aliveperiodically as a heartbeat to keep the session alive beyond the 5-minute idle timeout.