Skip to main content
The core SDK is event-driven. After starting a session, subscribe to events to receive streamed message chunks, tips, tool calls, and lifecycle signals. Drive your UI off these events.

Subscribing

off() requires the same function reference you passed to on(). Inline arrow functions can’t be removed — keep a reference if you need to unsubscribe.

Event reference

Use the SYNAPSE_REALTIME_EVENTS enum — never hardcode the string values.
EventFires when
CONNECTEDThe session connects.
DISCONNECTEDThe connection drops. Payload carries a DisconnectionReason.
PROGRESS_MESSAGEThe agent emits an interim “working on it” status.
MESSAGE_CHUNKA streamed slice of the assistant’s reply. Concatenate these.
TIPS_MESSAGESuggested follow-up prompts (data.tips).
END_OF_STREAMThe current assistant message is complete.
ERRORA stream or server error. See error codes.
TOOL_CALLThe agent invokes a tool / asks for input. See Tool calls.
TOOL_STARTA tool begins executing.
TOOL_ENDA tool finishes executing.
AUDIO_TRANSCRIPTA transcript of recorded audio. See Voice & audio.

Event payload

Every listener receives a SynapseRealTimeEventData object:

Streaming a message

A single assistant reply arrives as many MESSAGE_CHUNK events followed by one END_OF_STREAM. Accumulate chunks, then finalize:

Next steps

Tool calls & elicitation

Handle TOOL_CALL events — render inputs and send results back.