All Guides
Azure AI & Copilot

How to Build a Safe Azure AI Voice Agent with Azure AI Projects 2.11.0

365 Consultants16 min read

Azure AI Projects 2.11.0 makes Voice Agents generally available through the SDK, while GPT Live, inline subagent handoff, SIP, campaigns, and some telephony features remain preview. Start with a narrow, reversible voice pilot and validate identity, audio, tools, transcripts, and rollback before connecting customers.

What Azure AI Projects 2.11.0 changes

The 365Forge feed identifies Azure AI Projects 2.11.0 as a general-availability release for Voice Agents, with real-time voice, conversation, and telephony operations promoted into the main SDK surface. Microsoft’s release notes also distinguish those GA operations from GPT Live, inline subagent handoff, SIP, post-call delivery, and campaigns, which remain preview capabilities.

This guide uses the stable Voice Agent path for a small Python pilot. It does not treat every voice-related feature in the release as production-ready.

Check the project and identity prerequisites

Before writing code, confirm all of the following:

  • Python 3.10 or later.
  • An Azure subscription and a Microsoft Foundry project.
  • A project endpoint in the form https://<resource>.services.ai.azure.com/api/projects/<project>.
  • Azure CLI installed and an interactive az login completed for the account you will use during the pilot.
  • An identity with the Microsoft Foundry permissions required to create and invoke agents in the target project.
  • A model and voice available in the target region and subscription.
  • A microphone, speakers, or headset for the local test client.

Voice Agents can handle real-time speech, but availability, quotas, supported models, and regional behavior still need to be checked in the Foundry portal for your project. Do not put an API key, client secret, or token in the sample or in source control.

Install the SDK and voice dependencies

Create an isolated environment and install the SDK with its voice extra:

python -m venv .venv . .venv/bin/activate python -m pip install --upgrade pip python -m pip install "azure-ai-projects==2.11.0" azure-identity pyaudio

The SDK release notes identify version 2.11.0 as the release that promotes the core Voice Agent operations. If your environment cannot install that exact version yet, stop and resolve package availability rather than silently mixing examples from a different SDK surface.

Verify the installed version:

python -m pip show azure-ai-projects

Set only non-secret configuration

Set the Foundry project endpoint and the name you want to use for the agent. Keep the endpoint in your shell environment or a protected local configuration file:

export FOUNDRY_PROJECT_ENDPOINT="https://RESOURCE.services.ai.azure.com/api/projects/PROJECT" export FOUNDRY_VOICE_AGENT_NAME="support-voice-pilot"

Use DefaultAzureCredential so local development can use Azure CLI authentication and a deployed application can use its managed identity. Do not replace this with a credential embedded in code.

Define a small voice agent

A voice agent definition combines the model, instructions, greeting, audio input, audio output, turn detection, tools, storage behavior, and optional interim responses. Start with short instructions and no write-capable tools. Add one approved tool only after the basic conversation works.

The following definition follows Microsoft’s documented Python configuration pattern:

import os from azure.ai.projects import AIProjectClient from azure.ai.projects.models import ( VoiceAgentDefinition, VoiceModelType, ) from azure.identity import DefaultAzureCredential endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] agent_name = os.environ["FOUNDRY_VOICE_AGENT_NAME"] definition = VoiceAgentDefinition( model_type=VoiceModelType.MANAGED, model="gpt-realtime-2.1", instructions=( "You are a support triage assistant. " "Ask one question at a time, confirm important details, " "and never claim that a ticket was created unless a tool confirms it." ), ) with ( DefaultAzureCredential() as credential, AIProjectClient( endpoint=endpoint, credential=credential, allow_preview=True, ) as project_client, ): created = project_client.agents.create_version( agent_name=agent_name, definition=definition, ) print(f"Created {created.name}, version {created.version}")

The allow_preview=True flag is retained here because the Microsoft Learn configuration article documents it for voice-agent creation and because related voice capabilities can still be preview even when the core SDK operations have GA status. Confirm the current service requirement before removing it.

Add turn detection and a voice deliberately

A useful first pilot should make the audio contract explicit. Twenty-four-kilohertz PCM is the documented default in the Foundry voice examples, but set the input and output configuration instead of assuming that every client uses the same format.

A minimal input configuration looks like this:

from azure.ai.projects.models import ( RealtimeAudioFormatsAudioPcm, VoiceAgentAudioConfig, VoiceAgentAudioInputConfig, VoiceAgentServerVadTurnDetection, ) input_audio = VoiceAgentAudioInputConfig( format=RealtimeAudioFormatsAudioPcm(rate=24000), turn_detection=VoiceAgentServerVadTurnDetection( threshold=0.5, prefix_padding_ms=300, silence_duration_ms=500, ), ) definition.audio = VoiceAgentAudioConfig(input=input_audio)

Tune silence duration and turn detection with real users. A short threshold makes the agent feel responsive but can cut off slower speakers; a long threshold makes the agent feel sluggish. Record the chosen values in the pilot notes.

For output, select a documented voice type, locale, and speed that match your use case. Avoid cloning a human voice or implying that the agent is a person without an explicit disclosure and an approved legal and product review.

Create an immutable agent version

Create a new version for each material configuration change. Microsoft documents that create and update operations produce immutable versions, so you can test a new version and roll back by selecting the previous one without changing the agent’s stable name or endpoint.

Keep the version identifier in your deployment record with:

  • The source-control commit or configuration hash.
  • The model and voice.
  • Tool definitions and approval rules.
  • The test transcript IDs or timestamps.
  • The owner and rollback decision.

This is more reliable than treating a successful API response as proof that the agent is ready for production traffic.

Open a realtime session for a test

The Python SDK exposes the realtime connection under the client’s voice-agent operations. The current Microsoft sample surface uses the following connection shape:

from azure.ai.projects.models import VoiceAgentTransport with project_client.beta.voice_agents.realtime.connect( agent_name=agent_name, transport=VoiceAgentTransport.WEBSOCKET, ) as connection: print("Voice Agent connection is ready") # Send 24-kHz PCM microphone frames here. # Iterate over typed server events and play returned audio frames.

The SDK documentation still shows this realtime connection under beta in Python examples, while the 2.11.0 release notes promote the core Voice Agent operations into .voice_agents. Treat the connection namespace as version-sensitive: pin the package, run the official sample for that version, and fail the build if the import or connection path changes. Do not copy a preview GPT Live sample into a standard Voice Agent deployment.

Use headphones during testing to prevent speaker output from feeding back into the microphone. Wait for the session-ready event before sending audio, handle disconnects and error events, and close the connection cleanly when the test ends.

Add one read-only tool before write actions

Voice Agents can call tools, but a spoken interface can make an unsafe action sound deceptively simple. Use a staged tool policy:

  1. Start with no tools and validate the conversation.
  2. Add one read-only lookup tool with a narrow schema.
  3. Log the request, arguments, result, and user-visible confirmation.
  4. Add write-capable tools only after an explicit approval step and a source-system read-back.
  5. Give the agent a refusal instruction for ambiguous identity, authorization, or destructive requests.

For example, a ticket-creation tool should require a confirmed user, a validated category, an idempotency key, and a response from the ticket system. The agent should never say “created” because it intended to call a tool; it should say it only after the tool returns success and the application verifies the new record.

Test the failure paths, not just the happy path

Run a pilot matrix before exposing the agent to customers:

TestExpected result
Quiet room, clear speechCorrect turn detection and transcript
Slow speaker and interruptionNo premature cutoff; interruption is handled cleanly
Background noiseAgent asks for clarification instead of guessing
Unsupported requestAgent states the boundary and offers a safe alternative
Tool timeoutAgent explains that the action is pending; no false success
Duplicate requestApplication prevents duplicate writes with an idempotency key
Expired identitySession fails safely and does not fall back to a shared secret
ReconnectApplication records the failed session and can retry deliberately

Review latency, first-audio time, transcription quality, tool errors, and incomplete conversations. Keep audio and transcript retention aligned with your privacy, employment, healthcare, and regulatory requirements. The store setting controls whether conversations are persisted; choose it deliberately rather than inheriting a default.

Roll back by version, not by emergency edits

Before a production pilot:

  • Save the agent name, active version, and previous known-good version.
  • Keep the prior model, audio, and tool configuration available.
  • Test that the client can select the previous version or disable the voice route.
  • Revoke only the pilot tool permissions if the issue is tool-specific.
  • Preserve the failed session IDs and diagnostics for review.

If the agent produces unsafe answers, inaccurate transcripts, unexpected tool calls, or unacceptable latency, stop routing new sessions to the new version and return to the last tested version. Do not patch prompts or permissions directly in production without recording a new version and repeating the pilot checks.

Know what is GA and what is still preview

The 2.11.0 release marks the core Voice Agent realtime, conversation, and selected telephony operations as generally available. It does not make every related feature GA. GPT Live, inline subagent handoff, SIP, post-call delivery, campaigns, and several advanced telephony paths remain preview according to the release notes.

Microsoft’s Foundry documentation also warns that preview voice, monitoring, avatar, WebRTC, and telephony capabilities may not have a service-level agreement and are not recommended for production until support, security, compliance, and availability requirements are reviewed.

Use the GA path for the smallest useful workload, keep preview features behind a separate feature flag, and re-check the release notes before upgrading the SDK or changing the connection surface.

Before you call the pilot ready

  • [ ] SDK version is pinned and recorded.
  • [ ] Project endpoint and identity use protected configuration.
  • [ ] Agent name and immutable version are recorded.
  • [ ] Model, voice, locale, audio rate, and turn detection are documented.
  • [ ] No write-capable tool is enabled without approval and read-back.
  • [ ] Microphone, interruption, noise, timeout, retry, and reconnect tests passed.
  • [ ] Transcript and audio retention are intentional.
  • [ ] Monitoring captures latency, errors, tool calls, and session outcomes.
  • [ ] Previous version and traffic-disable procedure are tested.
  • [ ] Preview capabilities are separated from the GA pilot path.

Build the narrow version first

Azure AI Projects 2.11.0 is a meaningful step for teams that want managed real-time voice without building the entire conversation and audio control plane themselves. The safe implementation is still an engineering exercise: pin the SDK, define a narrow agent, test the audio loop, add tools gradually, verify every write, and keep rollback one version away.

Microsoft documentation and the 365Forge signal

  • 365Forge Live Feed: https://365forge.net/feed
  • Azure AI Projects 2.11.0 release notes: https://github.com/Azure/azure-sdk-for-python/releases/tag/azure-ai-projects_2.11.0
  • Microsoft Learn — Configure a voice agent: https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/configure-voice-agent
  • Microsoft Learn — Create a voice-based prompt agent: https://learn.microsoft.com/en-us/azure/foundry/agents/quickstarts/prompt-voice-agent
  • Microsoft Learn — Azure AI Projects Python SDK: https://learn.microsoft.com/en-us/python/api/overview/azure/ai-projects-readme?view=azure-python
  • Microsoft Foundry voice agent overview: https://learn.microsoft.com/en-us/azure/foundry/agents/overview

*Microsoft, Azure, Microsoft Foundry, and Microsoft 365 are trademarks of Microsoft Corporation. This independent article is not affiliated with Microsoft.*

Azure AI Projects Microsoft Foundry Voice Agents Python Realtime AI Azure AI Operations
All GuidesView on 365consultants.net →