aio Package
Classes
| ConnectionClosed |
Raised when a WebSocket connection is closed. |
| ConnectionError |
Base exception for Voice Live WebSocket connection errors. |
| ConversationItemResource |
Resource for conversation item management. Initialize a conversation item resource. |
| ConversationResource |
Resource for conversation management. Exposes helpers for manipulating items in the active conversation. Initialize a conversation resource. |
| InputAudioBufferResource |
Resource for input audio buffer management. Initialize an input audio buffer resource. |
| OutputAudioBufferResource |
Resource for output audio buffer management. Initialize an output audio buffer resource. |
| ResponseResource |
Resource for response management. Initialize a response resource. |
| SessionResource |
Resource for session management. Initialize a session resource. |
| TranscriptionSessionResource |
Resource for transcription session management. Initialize a transcription session resource. |
| VoiceLiveConnection |
Represents an active asynchronous WebSocket connection to the Azure Voice Live API. This class exposes resource-specific helpers for interacting with the service:
Instances are yielded by the connect context manager. Initialize a VoiceLiveConnection instance. |
| WebsocketConnectionOptions |
Transport-agnostic WebSocket connection options for VoiceLive. These control common WS behaviors (compression, message size limits, timeouts, ping/pong handling). Unless specified, defaults are determined by the underlying WebSocket library. |
Functions
connect
Create and manage an asynchronous WebSocket connection to the Azure Voice Live API.
This helper returns an async context manager that:
- Authenticates with the service using an API key or Azure Active Directory token.
- Prepares the correct WebSocket URL and query parameters.
- Establishes the connection and yields a VoiceLiveConnection.
- Automatically cleans up the connection when the context exits.
Additional legacy keyword arguments are accepted for backward compatibility. Unknown values are ignored.
connect(*, credential: AzureKeyCredential | AsyncTokenCredential, endpoint: str, api_version: str = '2026-04-10', model: str | None = None, agent_name: str | None = None, project_name: str | None = None, agent_version: str | None = None, conversation_id: str | None = None, authentication_identity_client_id: str | None = None, foundry_resource_override: str | None = None, query: Mapping[str, Any] | None = None, headers: Mapping[str, Any] | None = None, connection_options: WebsocketConnectionOptions | None = None, credential_scopes: str | Sequence[str] | None = None, **kwargs: Any) -> AbstractAsyncContextManager[VoiceLiveConnection]
Keyword-Only Parameters
| Name | Description |
|---|---|
|
credential
|
AzureKeyCredential or
<xref:azure.core.credentials.AsyncTokenCredential>
The credential used to authenticate with the service. |
|
endpoint
|
Service endpoint, e.g., |
|
api_version
|
The API version to use. Defaults to Default value: 2026-04-10
|
|
model
|
Model identifier to use for the session. In most scenarios, this parameter is required. It may be omitted only when connecting through an Agent scenario, in which case the service will use the model associated with the Agent. Default value: None
|
|
agent_name
|
Optional Azure AI Foundry agent name. When set, Default value: None
|
|
project_name
|
Azure AI Foundry project name. Required when Default value: None
|
|
agent_version
|
Optional Azure AI Foundry agent version. Default value: None
|
|
conversation_id
|
Optional Azure AI Foundry conversation ID to continue. Default value: None
|
|
authentication_identity_client_id
|
Optional client ID used for Foundry authentication identity. Default value: None
|
|
foundry_resource_override
|
Optional override for the Azure AI Foundry resource. Default value: None
|
|
query
|
Optional query parameters to include in the WebSocket URL. Default value: None
|
|
headers
|
Optional HTTP headers to include in the WebSocket handshake. Default value: None
|
|
connection_options
|
Optional advanced WebSocket options compatible with aiohttp. Default value: None
|
|
credential_scopes
|
Optional scope override for token-based authentication. Default value: None
|
Returns
| Type | Description |
|---|---|
|
<xref:collections.abc.AsyncContextManager>[VoiceLiveConnection]
|
An async context manager yielding a connected VoiceLiveConnection. |
Exceptions
| Type | Description |
|---|---|
|
If only one of |