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
| on |
Called when the session connects successfully to the VoiceLive service |
| on |
Called when a conversation item is created |
| on |
Called when a conversation item is deleted |
| on |
Called when input audio transcription is completed |
| on |
Called when input audio transcription delta is received |
| on |
Called when input audio transcription fails |
| on |
Called when a conversation item is retrieved |
| on |
Called when a conversation item is truncated |
| on |
Called when the session disconnects from the VoiceLive service In fail-fast mode, this indicates the session is permanently dead |
| on |
Called when an error occurs that makes the session unusable In fail-fast mode, this indicates the session is permanently dead |
| on |
Called when the input audio buffer is cleared |
| on |
Called when the input audio buffer is committed |
| on |
Called when speech is detected in the user's audio input |
| on |
Called when speech stops being detected in the user's audio input |
| on |
Called when MCP tool listing is completed |
| on |
Called when MCP tool listing fails |
| on |
Called when MCP tool listing is in progress |
| on |
Called when animation blendshape data is received |
| on |
Called when animation blendshape data is completed |
| on |
Called when animation viseme data is received |
| on |
Called when animation viseme data is completed |
| on |
Called when audio data is received from the assistant (streaming audio response) |
| on |
Called when audio response is completed |
| on |
Called when audio timestamp data is received |
| on |
Called when audio timestamp data is completed |
| on |
Called when audio transcript data is received (what the assistant said as text) |
| on |
Called when audio transcript is completed |
| on |
Called when a new content part is added to a response |
| on |
Called when a content part is completed |
| on |
Called when a response is created by the assistant |
| on |
Called when a response is completed by the assistant |
| on |
Called when function call arguments are received (streaming) |
| on |
Called when function call arguments are completed |
| on |
Called when MCP call arguments are received (streaming) |
| on |
Called when MCP call arguments are completed |
| on |
Called when an MCP call is completed |
| on |
Called when an MCP call fails |
| on |
Called when an MCP call is in progress |
| on |
Called when a new output item is added to a response |
| on |
Called when an output item is completed |
| on |
Called when text data is received from the assistant (streaming text response) |
| on |
Called when text response is completed |
| on |
Called when an error event is received from the server |
| on |
Called for all server events from the VoiceLive service. This is a catch-all handler that receives every server protocol message. Use this for:
Note: This is called IN ADDITION TO any specific handlers above. |
| on |
Called when the server is establishing an avatar media connection |
| on |
Called when the session is created on the server |
| on |
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>