Share via


VoiceLiveSessionHandlers interface

Handler functions for VoiceLive session events following Azure SDK patterns.

ALL handlers are optional - implement only the events you care about! Each handler receives strongly-typed event data and context information.

Properties

onConnected

Called when the session connects successfully to the VoiceLive service

onConversationItemCreated

Called when a conversation item is created

onConversationItemDeleted

Called when a conversation item is deleted

onConversationItemInputAudioTranscriptionCompleted

Called when input audio transcription is completed

onConversationItemInputAudioTranscriptionDelta

Called when input audio transcription delta is received

onConversationItemInputAudioTranscriptionFailed

Called when input audio transcription fails

onConversationItemRetrieved

Called when a conversation item is retrieved

onConversationItemTruncated

Called when a conversation item is truncated

onDisconnected

Called when the session disconnects from the VoiceLive service In fail-fast mode, this indicates the session is permanently dead

onError

Called when an error occurs that makes the session unusable In fail-fast mode, this indicates the session is permanently dead

onInputAudioBufferCleared

Called when the input audio buffer is cleared

onInputAudioBufferCommitted

Called when the input audio buffer is committed

onInputAudioBufferSpeechStarted

Called when speech is detected in the user's audio input

onInputAudioBufferSpeechStopped

Called when speech stops being detected in the user's audio input

onMcpListToolsCompleted

Called when MCP tool listing is completed

onMcpListToolsFailed

Called when MCP tool listing fails

onMcpListToolsInProgress

Called when MCP tool listing is in progress

onResponseAnimationBlendshapeDelta

Called when animation blendshape data is received

onResponseAnimationBlendshapeDone

Called when animation blendshape data is completed

onResponseAnimationVisemeDelta

Called when animation viseme data is received

onResponseAnimationVisemeDone

Called when animation viseme data is completed

onResponseAudioDelta

Called when audio data is received from the assistant (streaming audio response)

onResponseAudioDone

Called when audio response is completed

onResponseAudioTimestampDelta

Called when audio timestamp data is received

onResponseAudioTimestampDone

Called when audio timestamp data is completed

onResponseAudioTranscriptDelta

Called when audio transcript data is received (what the assistant said as text)

onResponseAudioTranscriptDone

Called when audio transcript is completed

onResponseContentPartAdded

Called when a new content part is added to a response

onResponseContentPartDone

Called when a content part is completed

onResponseCreated

Called when a response is created by the assistant

onResponseDone

Called when a response is completed by the assistant

onResponseFunctionCallArgumentsDelta

Called when function call arguments are received (streaming)

onResponseFunctionCallArgumentsDone

Called when function call arguments are completed

onResponseMcpCallArgumentsDelta

Called when MCP call arguments are received (streaming)

onResponseMcpCallArgumentsDone

Called when MCP call arguments are completed

onResponseMcpCallCompleted

Called when an MCP call is completed

onResponseMcpCallFailed

Called when an MCP call fails

onResponseMcpCallInProgress

Called when an MCP call is in progress

onResponseOutputItemAdded

Called when a new output item is added to a response

onResponseOutputItemDone

Called when an output item is completed

onResponseTextDelta

Called when text data is received from the assistant (streaming text response)

onResponseTextDone

Called when text response is completed

onServerError

Called when an error event is received from the server

onServerEvent

Called for all server events from the VoiceLive service. This is a catch-all handler that receives every server protocol message.

Use this for:

  • Custom logging/monitoring of all events
  • Handling future events not yet covered by specific handlers
  • Debugging and development

Note: This is called IN ADDITION TO any specific handlers above.

onSessionAvatarConnecting

Called when the server is establishing an avatar media connection

onSessionCreated

Called when the session is created on the server

onSessionUpdated

Called when the session configuration is updated

Property Details

onConnected

Called when the session connects successfully to the VoiceLive service

onConnected?: (args: ConnectedEventArgs, context: ConnectionContext) => Promise<void>

Property Value

(args: ConnectedEventArgs, context: ConnectionContext) => Promise<void>

onConversationItemCreated

Called when a conversation item is created

onConversationItemCreated?: (event: ServerEventConversationItemCreated, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventConversationItemCreated, context: SessionContext) => Promise<void>

onConversationItemDeleted

Called when a conversation item is deleted

onConversationItemDeleted?: (event: ServerEventConversationItemDeleted, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventConversationItemDeleted, context: SessionContext) => Promise<void>

onConversationItemInputAudioTranscriptionCompleted

Called when input audio transcription is completed

onConversationItemInputAudioTranscriptionCompleted?: (event: ServerEventConversationItemInputAudioTranscriptionCompleted, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventConversationItemInputAudioTranscriptionCompleted, context: SessionContext) => Promise<void>

onConversationItemInputAudioTranscriptionDelta

Called when input audio transcription delta is received

onConversationItemInputAudioTranscriptionDelta?: (event: ServerEventConversationItemInputAudioTranscriptionDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventConversationItemInputAudioTranscriptionDelta, context: SessionContext) => Promise<void>

onConversationItemInputAudioTranscriptionFailed

Called when input audio transcription fails

onConversationItemInputAudioTranscriptionFailed?: (event: ServerEventConversationItemInputAudioTranscriptionFailed, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventConversationItemInputAudioTranscriptionFailed, context: SessionContext) => Promise<void>

onConversationItemRetrieved

Called when a conversation item is retrieved

onConversationItemRetrieved?: (event: ServerEventConversationItemRetrieved, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventConversationItemRetrieved, context: SessionContext) => Promise<void>

onConversationItemTruncated

Called when a conversation item is truncated

onConversationItemTruncated?: (event: ServerEventConversationItemTruncated, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventConversationItemTruncated, context: SessionContext) => Promise<void>

onDisconnected

Called when the session disconnects from the VoiceLive service In fail-fast mode, this indicates the session is permanently dead

onDisconnected?: (args: DisconnectedEventArgs, context: ConnectionContext) => Promise<void>

Property Value

(args: DisconnectedEventArgs, context: ConnectionContext) => Promise<void>

onError

Called when an error occurs that makes the session unusable In fail-fast mode, this indicates the session is permanently dead

onError?: (args: ErrorEventArgs, context: ConnectionContext) => Promise<void>

Property Value

(args: ErrorEventArgs, context: ConnectionContext) => Promise<void>

onInputAudioBufferCleared

Called when the input audio buffer is cleared

onInputAudioBufferCleared?: (event: ServerEventInputAudioBufferCleared, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventInputAudioBufferCleared, context: SessionContext) => Promise<void>

onInputAudioBufferCommitted

Called when the input audio buffer is committed

onInputAudioBufferCommitted?: (event: ServerEventInputAudioBufferCommitted, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventInputAudioBufferCommitted, context: SessionContext) => Promise<void>

onInputAudioBufferSpeechStarted

Called when speech is detected in the user's audio input

onInputAudioBufferSpeechStarted?: (event: ServerEventInputAudioBufferSpeechStarted, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventInputAudioBufferSpeechStarted, context: SessionContext) => Promise<void>

onInputAudioBufferSpeechStopped

Called when speech stops being detected in the user's audio input

onInputAudioBufferSpeechStopped?: (event: ServerEventInputAudioBufferSpeechStopped, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventInputAudioBufferSpeechStopped, context: SessionContext) => Promise<void>

onMcpListToolsCompleted

Called when MCP tool listing is completed

onMcpListToolsCompleted?: (event: ServerEventMcpListToolsCompleted, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventMcpListToolsCompleted, context: SessionContext) => Promise<void>

onMcpListToolsFailed

Called when MCP tool listing fails

onMcpListToolsFailed?: (event: ServerEventMcpListToolsFailed, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventMcpListToolsFailed, context: SessionContext) => Promise<void>

onMcpListToolsInProgress

Called when MCP tool listing is in progress

onMcpListToolsInProgress?: (event: ServerEventMcpListToolsInProgress, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventMcpListToolsInProgress, context: SessionContext) => Promise<void>

onResponseAnimationBlendshapeDelta

Called when animation blendshape data is received

onResponseAnimationBlendshapeDelta?: (event: ServerEventResponseAnimationBlendshapeDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAnimationBlendshapeDelta, context: SessionContext) => Promise<void>

onResponseAnimationBlendshapeDone

Called when animation blendshape data is completed

onResponseAnimationBlendshapeDone?: (event: ServerEventResponseAnimationBlendshapeDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAnimationBlendshapeDone, context: SessionContext) => Promise<void>

onResponseAnimationVisemeDelta

Called when animation viseme data is received

onResponseAnimationVisemeDelta?: (event: ServerEventResponseAnimationVisemeDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAnimationVisemeDelta, context: SessionContext) => Promise<void>

onResponseAnimationVisemeDone

Called when animation viseme data is completed

onResponseAnimationVisemeDone?: (event: ServerEventResponseAnimationVisemeDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAnimationVisemeDone, context: SessionContext) => Promise<void>

onResponseAudioDelta

Called when audio data is received from the assistant (streaming audio response)

onResponseAudioDelta?: (event: ServerEventResponseAudioDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAudioDelta, context: SessionContext) => Promise<void>

onResponseAudioDone

Called when audio response is completed

onResponseAudioDone?: (event: ServerEventResponseAudioDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAudioDone, context: SessionContext) => Promise<void>

onResponseAudioTimestampDelta

Called when audio timestamp data is received

onResponseAudioTimestampDelta?: (event: ServerEventResponseAudioTimestampDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAudioTimestampDelta, context: SessionContext) => Promise<void>

onResponseAudioTimestampDone

Called when audio timestamp data is completed

onResponseAudioTimestampDone?: (event: ServerEventResponseAudioTimestampDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAudioTimestampDone, context: SessionContext) => Promise<void>

onResponseAudioTranscriptDelta

Called when audio transcript data is received (what the assistant said as text)

onResponseAudioTranscriptDelta?: (event: ServerEventResponseAudioTranscriptDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAudioTranscriptDelta, context: SessionContext) => Promise<void>

onResponseAudioTranscriptDone

Called when audio transcript is completed

onResponseAudioTranscriptDone?: (event: ServerEventResponseAudioTranscriptDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseAudioTranscriptDone, context: SessionContext) => Promise<void>

onResponseContentPartAdded

Called when a new content part is added to a response

onResponseContentPartAdded?: (event: ServerEventResponseContentPartAdded, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseContentPartAdded, context: SessionContext) => Promise<void>

onResponseContentPartDone

Called when a content part is completed

onResponseContentPartDone?: (event: ServerEventResponseContentPartDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseContentPartDone, context: SessionContext) => Promise<void>

onResponseCreated

Called when a response is created by the assistant

onResponseCreated?: (event: ServerEventResponseCreated, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseCreated, context: SessionContext) => Promise<void>

onResponseDone

Called when a response is completed by the assistant

onResponseDone?: (event: ServerEventResponseDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseDone, context: SessionContext) => Promise<void>

onResponseFunctionCallArgumentsDelta

Called when function call arguments are received (streaming)

onResponseFunctionCallArgumentsDelta?: (event: ServerEventResponseFunctionCallArgumentsDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseFunctionCallArgumentsDelta, context: SessionContext) => Promise<void>

onResponseFunctionCallArgumentsDone

Called when function call arguments are completed

onResponseFunctionCallArgumentsDone?: (event: ServerEventResponseFunctionCallArgumentsDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseFunctionCallArgumentsDone, context: SessionContext) => Promise<void>

onResponseMcpCallArgumentsDelta

Called when MCP call arguments are received (streaming)

onResponseMcpCallArgumentsDelta?: (event: ServerEventResponseMcpCallArgumentsDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseMcpCallArgumentsDelta, context: SessionContext) => Promise<void>

onResponseMcpCallArgumentsDone

Called when MCP call arguments are completed

onResponseMcpCallArgumentsDone?: (event: ServerEventResponseMcpCallArgumentsDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseMcpCallArgumentsDone, context: SessionContext) => Promise<void>

onResponseMcpCallCompleted

Called when an MCP call is completed

onResponseMcpCallCompleted?: (event: ServerEventResponseMcpCallCompleted, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseMcpCallCompleted, context: SessionContext) => Promise<void>

onResponseMcpCallFailed

Called when an MCP call fails

onResponseMcpCallFailed?: (event: ServerEventResponseMcpCallFailed, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseMcpCallFailed, context: SessionContext) => Promise<void>

onResponseMcpCallInProgress

Called when an MCP call is in progress

onResponseMcpCallInProgress?: (event: ServerEventResponseMcpCallInProgress, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseMcpCallInProgress, context: SessionContext) => Promise<void>

onResponseOutputItemAdded

Called when a new output item is added to a response

onResponseOutputItemAdded?: (event: ServerEventResponseOutputItemAdded, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseOutputItemAdded, context: SessionContext) => Promise<void>

onResponseOutputItemDone

Called when an output item is completed

onResponseOutputItemDone?: (event: ServerEventResponseOutputItemDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseOutputItemDone, context: SessionContext) => Promise<void>

onResponseTextDelta

Called when text data is received from the assistant (streaming text response)

onResponseTextDelta?: (event: ServerEventResponseTextDelta, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseTextDelta, context: SessionContext) => Promise<void>

onResponseTextDone

Called when text response is completed

onResponseTextDone?: (event: ServerEventResponseTextDone, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventResponseTextDone, context: SessionContext) => Promise<void>

onServerError

Called when an error event is received from the server

onServerError?: (event: ServerEventError, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventError, context: SessionContext) => Promise<void>

onServerEvent

Called for all server events from the VoiceLive service. This is a catch-all handler that receives every server protocol message.

Use this for:

  • Custom logging/monitoring of all events
  • Handling future events not yet covered by specific handlers
  • Debugging and development

Note: This is called IN ADDITION TO any specific handlers above.

onServerEvent?: (event: ServerEventUnion, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventUnion, context: SessionContext) => Promise<void>

onSessionAvatarConnecting

Called when the server is establishing an avatar media connection

onSessionAvatarConnecting?: (event: ServerEventSessionAvatarConnecting, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventSessionAvatarConnecting, context: SessionContext) => Promise<void>

onSessionCreated

Called when the session is created on the server

onSessionCreated?: (event: ServerEventSessionCreated, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventSessionCreated, context: SessionContext) => Promise<void>

onSessionUpdated

Called when the session configuration is updated

onSessionUpdated?: (event: ServerEventSessionUpdated, context: SessionContext) => Promise<void>

Property Value

(event: ServerEventSessionUpdated, context: SessionContext) => Promise<void>