VoiceAgentDefinition Class

The voice agent definition. Its configuration (model, instructions, audio, tools, and optional avatar) drives a managed speech-to-speech experience. Establish realtime voice sessions through GET /agents/{agent_name}/endpoint/protocols/voice. Every create or update produces a new immutable version.

Constructor

VoiceAgentDefinition(*args: Any, **kwargs: Any)

Variables

Name Description
rai_config

Configuration for Responsible AI (RAI) content filtering and safety features.

kind
str or <xref:azure.ai.projects.models.VOICE>

The kind discriminator for a voice agent definition. Always voice. Required. VOICE.

model_type

How the model backing this voice agent is served. Required with model for a model-backed voice agent and omitted when conversation_engine is provided. This is independent of the architecture (realtime or cascaded), which the service derives from the selected model. Known values are: "managed" and "self_deployed".

model
str

The model to use for this agent. Required with model_type for a model-backed voice agent and omitted when conversation_engine is provided. The model must support realtime or cascaded voice.

conversation_engine

The engine that owns conversation handling for this voice agent. Exactly one of this property and the model-backed configuration (model_type with model) must be provided. When this property is provided, model_type, model, instructions, tools, and tool_choice must be omitted, and greeting.tool_choice cannot be required, because the engine owns the conversation logic. The initial implementation supports a hosted-agent engine.

instructions
str

A system (or developer) message inserted into the model's context. Supports template substitution via structured_inputs, rendered per session before the live session starts.

greeting

Optional session-start greeting. Template mode speaks exact rendered text; LLM-generated mode asks the session model to author the opening response and may use configured tools.

audio

The audio configuration, including input and output formats, voice, turn detection, noise reduction, and transcription. These values are session defaults; a client may override supported fields when connecting.

output_modalities

The output modalities the agent produces. Defaults to ["audio"]. animation and avatar are available when an avatar is configured.

max_output_tokens
int or str

The maximum output-token count for one response. Is either a int type or a Literal["inf"] type.

include

Additional fields to include in service outputs.

interim_response

Interim-response settings for latency and tool execution.

avatar

Optional avatar configuration. These values are session defaults and may be overridden when connecting.

tools

The tools the voice agent may use. Supported tool kinds are function (executed by the client), mcp, system (service-managed session controls), and toolbox. Server-side tools such as web_search, azure_ai_search, and openapi are provided through a toolbox rather than declared directly.

tool_choice

How the model chooses tools for generated responses. none prevents tool calls, auto lets the model decide, required requires at least one tool call, and a specific function or MCP tool can be selected with an object. Defaults to auto. Is one of the following types: Literal["none"], Literal["auto"], Literal["required"], ToolChoiceFunction, ToolChoiceMCP

parallel_tool_calls

Whether the model may call multiple tools in parallel.

structured_inputs

Set of structured inputs that participate in prompt template substitution, rendered per session before the live session starts.

subagent_config

Optional configuration for sibling Foundry text agents that this voice agent may consult as background specialists.

store

Whether conversations with this agent are persisted. A single, all-or-nothing persistence switch that defaults to false (privacy-safe: off by default). When true, Foundry persists the full conversation — the transcript/event timeline and raw audio. When false, nothing is persisted and no conversation is surfaced. There is no separate audio-logging control; audio is persisted only as part of this switch. Latency/performance telemetry (e.g. time-to-first-audio, inter-token latency, interruption) is observability-only (customer trace / App Insights) and is not part of the persisted conversation content.

Methods

as_dict

Return a dict that can be turned into json using json.dump.

clear

Remove all items from the dictionary.

copy
get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: The value for key if key is in the dictionary, else default. :rtype: any

items
keys
pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if the dictionary is empty.

setdefault

Return the value for key if key is in the dictionary; otherwise set the key to default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: The value for key if key is in the dictionary, else default. :rtype: any

update

Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs.

values

as_dict

Return a dict that can be turned into json using json.dump.

as_dict(*, exclude_readonly: bool = False) -> dict[str, Any]

Keyword-Only Parameters

Name Description
exclude_readonly

Whether to remove the readonly properties.

Default value: False

Returns

Type Description

A dict JSON compatible object

clear

Remove all items from the dictionary.

clear() -> None

copy

copy() -> Model

get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: The value for key if key is in the dictionary, else default. :rtype: any

get(key: str, default: Any = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

items

items() -> ItemsView[str, Any]

Returns

Type Description

a set-like object providing a view on the mapping's items

keys

keys() -> KeysView[str]

Returns

Type Description

a set-like object providing a view on the mapping's keys

pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

pop(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if the dictionary is empty.

popitem() -> tuple[str, Any]

setdefault

Return the value for key if key is in the dictionary; otherwise set the key to default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: The value for key if key is in the dictionary, else default. :rtype: any

setdefault(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

update

Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs.

update(*args: Any, **kwargs: Any) -> None

values

values() -> ValuesView[Any]

Returns

Type Description

an object providing a view on the mapping's values

Attributes

audio

The audio configuration, including input and output formats, voice, turn detection, noise reduction, and transcription. These values are session defaults; a client may override supported fields when connecting.

audio: _models.VoiceAgentAudioConfig | None

avatar

Optional avatar configuration. These values are session defaults and may be overridden when connecting.

avatar: _models.VoiceAgentAvatarConfig | None

conversation_engine

The engine that owns conversation handling for this voice agent. Exactly one of this property and the model-backed configuration (model_type with model) must be provided. When this property is provided, model_type, model, instructions, tools, and tool_choice must be omitted, and greeting.tool_choice cannot be required, because the engine owns the conversation logic. The initial implementation supports a hosted-agent engine.

conversation_engine: _models.VoiceConversationEngine | None

greeting

Optional session-start greeting. Template mode speaks exact rendered text; LLM-generated mode asks the session model to author the opening response and may use configured tools.

greeting: _models.VoiceAgentGreetingConfig | None

include

Additional fields to include in service outputs.

include: list[typing.Union[str, ForwardRef('_models.VoiceAgentSessionIncludeOption')]] | None

instructions

A system (or developer) message inserted into the model's context. Supports template substitution via structured_inputs, rendered per session before the live session starts.

instructions: str | None

interim_response

Interim-response settings for latency and tool execution.

interim_response: _models.VoiceAgentInterimResponseConfig | None

kind

The kind discriminator for a voice agent definition. Always voice. Required. VOICE.

kind: VOICE: 'voice'>]

max_output_tokens

The maximum output-token count for one response. Is either a int type or a Literal["inf"] type.

max_output_tokens: _unions.VoiceAgentMaxOutputTokens | None

model

The model to use for this agent. Required with model_type for a model-backed voice agent and omitted when conversation_engine is provided. The model must support realtime or cascaded voice.

model: str | None

model_type

How the model backing this voice agent is served. Required with model for a model-backed voice agent and omitted when conversation_engine is provided. This is independent of the architecture (realtime or cascaded), which the service derives from the selected model. Known values are: "managed" and "self_deployed".

model_type: str | _models.VoiceModelType | None

output_modalities

The output modalities the agent produces. Defaults to ["audio"]. animation and avatar are available when an avatar is configured.

output_modalities: list[typing.Union[str, ForwardRef('_models.VoiceOutputModality')]] | None

parallel_tool_calls

Whether the model may call multiple tools in parallel.

parallel_tool_calls: bool | None

rai_config

Configuration for Responsible AI (RAI) content filtering and safety features.

rai_config: '_models.RaiConfig' | None

store

Whether conversations with this agent are persisted. A single, all-or-nothing persistence switch that defaults to false (privacy-safe: off by default). When true, Foundry persists the full conversation — the transcript/event timeline and raw audio. When false, nothing is persisted and no conversation is surfaced. There is no separate audio-logging control; audio is persisted only as part of this switch. Latency/performance telemetry (e.g. time-to-first-audio, inter-token latency, interruption) is observability-only (customer trace / App Insights) and is not part of the persisted conversation content.

store: bool | None

structured_inputs

Set of structured inputs that participate in prompt template substitution, rendered per session before the live session starts.

structured_inputs: dict[str, '_models.StructuredInputDefinition'] | None

subagent_config

Optional configuration for sibling Foundry text agents that this voice agent may consult as background specialists.

subagent_config: _models.VoiceAgentSubagentConfig | None

tool_choice

How the model chooses tools for generated responses. none prevents tool calls, auto lets the model decide, required requires at least one tool call, and a specific function or MCP tool can be selected with an object. Defaults to auto. Is one of the following types: Literal["none"], Literal["auto"], Literal["required"], ToolChoiceFunction, ToolChoiceMCP

tool_choice: _unions.VoiceAgentToolChoice | None

tools

The tools the voice agent may use. Supported tool kinds are function (executed by the client), mcp, system (service-managed session controls), and toolbox. Server-side tools such as web_search, azure_ai_search, and openapi are provided through a toolbox rather than declared directly.

tools: list['_models.VoiceAgentTool'] | None