Skip to navigation

Subscribe to live call events (SSE)

View as Markdown

Real-time streaming of user speech (STT) and agent speech (TTS) events for an active call via Server-Sent Events.

The connection is real-time — events stream directly from the call runtime as they are produced. The SSE connection auto-closes when the call ends (sse_close event). Only active calls can be subscribed to; completed calls return a 400 error.

Transcript event types:

  • user_interim_transcription — Partial, in-progress transcription as the user speaks. Use for live preview only; will be superseded by user_transcription.
  • user_transcription — Final transcription for a completed user speech turn.
  • tts_completed — Fired when the agent finishes speaking a TTS segment. Includes the spoken text and optionally TTS latency.

Lifecycle events:

  • sse_init — Sent immediately when the SSE connection is established.
  • sse_close — Sent when the call ends, right before the server closes the connection.

Other event types (e.g. tool_call_start, pre_call_api, agent_log, metrics) are also sent on this stream.

  • call_start
  • call_end
  • turn_latency
  • metrics
  • agent_node_state
  • hopping
  • knowledgebase
  • variable_extraction
  • pre_call_api
  • post_call_api
  • agent_error
  • agent_log
  • tool_call_start
  • tool_call_end
  • tool_call_error
  • call_cancelled
  • call_recording

Authentication

AuthorizationBearer

API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

Headers

X-Organization-IdstringOptional

Required when using session-cookie auth. API-token auth may infer the organization from the token.

Query parameters

callIdstringRequired

The call ID of an in-progress call. Behavior on error cases:

  • Missing: 400 {"status": false, "errors": ["CallId is required"]}.
  • callId belongs to another organization (the common case for a wrong ID): 404 "Agent not found".
  • Organization cannot be resolved from the auth context: 404 "Not authorized".
  • Non-existent call: 404 "Call log not found".
  • Completed call: 400 "Call is already completed".

A client that routes on the message string must handle all three 404 messages. Prefer routing on the HTTP status.

Response

SSE event stream established successfully
event_typeenumOptional
The type of event
event_idstringOptional
Unique identifier for the event
timestampdatetimeOptional
ISO 8601 timestamp of the event
call_idstringOptional
The call ID this event belongs to
event_timedatetimeOptional

Timestamp used by sse_init and sse_close

telephony_idstringOptional

Telephony ID for call_start

metadatamap from strings to anyOptional

Metadata for call_end, agent_error, or agent_log

turn_latencydoubleOptional

Turn latency value for turn_latency

stt_api_msdoubleOptional

STT API latency in milliseconds for turn_latency

stt_to_llm_msdoubleOptional

STT-to-LLM latency in milliseconds for turn_latency

smart_turn_msdoubleOptional

Smart-turn latency in milliseconds for turn_latency

llm_api_msdoubleOptional

LLM API latency in milliseconds for turn_latency

llm_to_tts_msdoubleOptional

LLM-to-TTS latency in milliseconds for turn_latency

tts_api_msdoubleOptional

TTS API latency in milliseconds for turn_latency

tts_to_audio_msdoubleOptional

TTS-to-audio latency in milliseconds for turn_latency

total_turn_msdoubleOptional

Total turn latency in milliseconds for turn_latency

turn_indexintegerOptional

Turn index for turn_latency

interruptedbooleanOptional

Whether the turn was interrupted for turn_latency

smart_turn_enabledbooleanOptional

Whether smart turn was enabled for turn_latency

interim_transcription_textstringOptional

Partial transcription text (only for user_interim_transcription)

user_transcription_textstringOptional

Final transcription text (only for user_transcription)

tts_textstringOptional

Text spoken by the agent (only for tts_completed)

tts_latencyintegerOptional

TTS latency in milliseconds (only for tts_completed)

metricslist of objectsOptional

Per-turn metrics payload for metrics events. Server emits an array of {processor, model, value} entries (one per pipeline stage), not a single object. The SDK previously dropped every metrics SSE event with a pydantic ValidationError when this was typed as an object (122 events on a 40s call); typing it as an array of objects fixes the decode.

node_idstringOptional

Node ID for agent_node_state

node_namestringOptional

Node name for agent_node_state

node_typestringOptional

Node type for agent_node_state

contextmap from strings to anyOptional

Context payload for agent-node and tool-call events

from_node_idstringOptional

Source node ID for hopping

to_node_idstringOptional

Destination node ID for hopping

knowledge_base_idstringOptional

Knowledge base ID for knowledgebase

user_transcriptstringOptional

User transcript for knowledgebase

responseany or nullOptional

Response payload for knowledgebase, API, or tool-call events

latencydoubleOptional

Latency for knowledgebase or variable_extraction

errorany or nullOptional
Error payload for knowledgebase, variable extraction, API, tool, or agent error events
variablesmap from strings to anyOptional

Variables extracted by variable_extraction

variable_extraction_promptstringOptional

Prompt used for variable_extraction

methodstringOptional

HTTP method for pre_call_api or post_call_api

headersmap from strings to anyOptional

Headers for pre_call_api or post_call_api

bodyany or nullOptional

Body for pre_call_api or post_call_api

timeoutdoubleOptional

Timeout for pre_call_api or post_call_api

extracted_variablesmap from strings to anyOptional

Extracted variables for pre_call_api or post_call_api

next_node_idstringOptional

Next node ID for pre_call_api or post_call_api

successbooleanOptional

Success status for API and tool-call events

turn_idstringOptional

Turn ID for tool-call events

tool_call_idstringOptional

Tool call ID for tool-call events

function_namestringOptional

Function name for tool-call events

latency_msdoubleOptional

Latency in milliseconds for tool_call_end

recording_urlstringOptional

Recording URL for call_recording

statusstringOptional

Recording status for call_recording

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error