Skip to content

Events

Iterating a RealtimeSession yields the session’s event stream: content parts, tool activity, turn boundaries, reconnects, and recoverable errors. The high-level stream_audio() and stream_transcripts() views described in Audio, images, and transcripts are derived from this same stream, so most applications iterate the session for control flow and leave media to the views.

Event reference

EventMeaning
PartStartEventA speech, text, or tool part started.
PartDeltaEventIncremental speech audio/transcript or text content.
PartEndEventA finalized part; retained speech audio appears here, not at part start.
FunctionToolCallEventA local function tool began executing.
FunctionToolResultEventA local function tool completed or returned a retry prompt.
DeferredToolRequestsEventAn inline capability handler resolved deferred requests.
DeferredToolResultsEventInline deferred results are ready for normal tool processing.
RealtimeInputSpeechStartEventThe provider detected that the user started speaking, when the profile declares emits_input_speech_events.
RealtimeInputSpeechEndEventThe provider detected the end of user speech, when the profile declares emits_input_speech_events.
RealtimeResponseInterruptedEventThe provider reported an interrupted model response.
RealtimeInputTranscriptionErrorEventOne user turn could not be transcribed; the session remains usable.
RealtimeOutputSpeechStartEvent / RealtimeOutputSpeechEndEventThe model became, or stopped being, audible. These are emitted on a WebRTC sideband, where the provider owns audio playback.
RealtimeTurnCompleteEventThe model finished replying and no tool remains active.
RealtimeSessionReconnectEventThe connection was automatically re-established.
RealtimeSessionErrorEventA recoverable provider error occurred; the session remains usable.

Shared and realtime-only events

The first seven rows are AgentStreamEvent members from pydantic_ai.messages — the same events a standard streamed run yields, so event-handling code written for a text agent (rendering parts, logging tool calls) works on a session unchanged. The Realtime* rows are RealtimeEvent members that only a session emits: speech detection, interruption, turn completion, reconnection, and recoverable errors have no equivalent in a request-response run.

A capability’s event stream hooks see both kinds flow through the same stream; see Capabilities and hooks.

The turn boundary

Use RealtimeTurnCompleteEvent as the exchange boundary. A model can speak, call a tool, and speak again, so receiving speech — or a tool result — does not imply that the turn is done.

Reading raw audio events

The audio stream is these events under the hood: stream_audio() is a bounded view over the speech part deltas, and most applications should use it. As an advanced alternative, play SpeechPartDelta.audio_chunk from raw PartDeltaEvents. Model audio arrives in full whether or not history retention is enabled. When output audio is retained, the final SpeechPart contains the whole turn again as a WAV snapshot for history; do not play both or the turn will play twice.