Sprog

ProjectsAgentsModelFactory.VoiceAgentDefinition Method

Definition

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.

public static Azure.AI.Projects.Agents.VoiceAgentDefinition VoiceAgentDefinition(Azure.AI.Projects.Agents.ContentFilterConfiguration contentFilterConfiguration = default, Azure.AI.Projects.Agents.VoiceModelType? modelType = default, string model = default, Azure.AI.Projects.Agents.VoiceConversationEngine conversationEngine = default, string instructions = default, Azure.AI.Projects.Agents.VoiceAgentGreetingConfig greeting = default, Azure.AI.Projects.Agents.VoiceAgentAudioConfig audio = default, System.Collections.Generic.IEnumerable<Azure.AI.Projects.Agents.VoiceOutputModality> outputModalities = default, BinaryData maxOutputTokens = default, System.Collections.Generic.IEnumerable<Azure.AI.Projects.Agents.VoiceAgentSessionIncludeOption> include = default, Azure.AI.Projects.Agents.VoiceAgentInterimResponseConfig interimResponse = default, Azure.AI.Projects.Agents.VoiceAgentAvatarConfig avatar = default, System.Collections.Generic.IEnumerable<Azure.AI.Projects.Agents.VoiceAgentTool> tools = default, BinaryData toolChoice = default, bool? parallelToolCalls = default, System.Collections.Generic.IDictionary<string,Azure.AI.Projects.Agents.StructuredInputDefinition> structuredInputs = default, Azure.AI.Projects.Agents.VoiceAgentSubagentConfig subagentConfig = default, bool? store = default);
static member VoiceAgentDefinition : Azure.AI.Projects.Agents.ContentFilterConfiguration * Nullable<Azure.AI.Projects.Agents.VoiceModelType> * string * Azure.AI.Projects.Agents.VoiceConversationEngine * string * Azure.AI.Projects.Agents.VoiceAgentGreetingConfig * Azure.AI.Projects.Agents.VoiceAgentAudioConfig * seq<Azure.AI.Projects.Agents.VoiceOutputModality> * BinaryData * seq<Azure.AI.Projects.Agents.VoiceAgentSessionIncludeOption> * Azure.AI.Projects.Agents.VoiceAgentInterimResponseConfig * Azure.AI.Projects.Agents.VoiceAgentAvatarConfig * seq<Azure.AI.Projects.Agents.VoiceAgentTool> * BinaryData * Nullable<bool> * System.Collections.Generic.IDictionary<string, Azure.AI.Projects.Agents.StructuredInputDefinition> * Azure.AI.Projects.Agents.VoiceAgentSubagentConfig * Nullable<bool> -> Azure.AI.Projects.Agents.VoiceAgentDefinition
Public Shared Function VoiceAgentDefinition (Optional contentFilterConfiguration As ContentFilterConfiguration = Nothing, Optional modelType As Nullable(Of VoiceModelType) = Nothing, Optional model As String = Nothing, Optional conversationEngine As VoiceConversationEngine = Nothing, Optional instructions As String = Nothing, Optional greeting As VoiceAgentGreetingConfig = Nothing, Optional audio As VoiceAgentAudioConfig = Nothing, Optional outputModalities As IEnumerable(Of VoiceOutputModality) = Nothing, Optional maxOutputTokens As BinaryData = Nothing, Optional include As IEnumerable(Of VoiceAgentSessionIncludeOption) = Nothing, Optional interimResponse As VoiceAgentInterimResponseConfig = Nothing, Optional avatar As VoiceAgentAvatarConfig = Nothing, Optional tools As IEnumerable(Of VoiceAgentTool) = Nothing, Optional toolChoice As BinaryData = Nothing, Optional parallelToolCalls As Nullable(Of Boolean) = Nothing, Optional structuredInputs As IDictionary(Of String, StructuredInputDefinition) = Nothing, Optional subagentConfig As VoiceAgentSubagentConfig = Nothing, Optional store As Nullable(Of Boolean) = Nothing) As VoiceAgentDefinition

Parameters

contentFilterConfiguration
ContentFilterConfiguration

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

modelType
Nullable<VoiceModelType>

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.

model
String

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.

conversationEngine
VoiceConversationEngine

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
String

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
VoiceAgentGreetingConfig

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
VoiceAgentAudioConfig

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.

outputModalities
IEnumerable<VoiceOutputModality>

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

maxOutputTokens
BinaryData

The maximum output-token count for one response.

include
IEnumerable<VoiceAgentSessionIncludeOption>

Additional fields to include in service outputs.

interimResponse
VoiceAgentInterimResponseConfig

Interim-response settings for latency and tool execution.

avatar
VoiceAgentAvatarConfig

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

tools
IEnumerable<VoiceAgentTool>

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.

toolChoice
BinaryData

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.

parallelToolCalls
Nullable<Boolean>

Whether the model may call multiple tools in parallel.

structuredInputs
IDictionary<String,StructuredInputDefinition>

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

subagentConfig
VoiceAgentSubagentConfig

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

store
Nullable<Boolean>

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.

Returns

A new VoiceAgentDefinition instance for mocking.

Applies to