Skip to main content
LiveAvatar processes events over the WebSocket connection returned when the session starts. Each frame is one JSON object sent as a text frame, up to 1 MB. All events follow this JSON structure:
  • 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. The event_id of the command that caused the event, or null when there is none.
Audio sent in any event must be PCM 16-bit 24 kHz mono, Base64-encoded.

Command Events

Send these over the WebSocket. event_id is optional on every command.
Wait for session.state_updated with state "connected" before sending any command events.
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 the event_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_alive periodically as a heartbeat to keep the session alive beyond the 5-minute idle timeout.