Deploy a hosted voice agent with the Azure Developer CLI

Deploy a hosted voice agent in Microsoft Foundry by using the Azure Developer CLI (azd). This walkthrough uses the Voice Live Bridge basic Python sample.

The sample deploys a hosted text agent and a separate voice wrapper. Voice Live handles speech recognition, turn detection, and speech synthesis; your hosted code generates response text.

This sample exchanges text and control events over invocations_ws. For a raw-audio pipeline, see Build a voice agent with hosted agents. For the dedicated voice_conversation_engine protocol, see Use a hosted agent as the conversation engine. These are separate deployment paths.

Important

Items marked preview in this article are currently in preview. This preview is provided without a service-level agreement, and Microsoft doesn't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

Prerequisites

  • Azure Developer CLI 1.37.0 or later and azure.ai.agents 1.0.0 or later. If you use extension 1.0.0 or 1.1.0, set the voice feature switch in your shell.
  • PowerShell 7.3 or later for the commands in this article.
  • Access to hosted agents and voice agents in your subscription and selected region.
  • The permissions to provision Foundry resources and deploy hosted agents.
  • Availability and quota for the model deployment declared in the sample's azure.yaml. The new-project configuration uses gpt-5.4-mini.
  • A supported browser, microphone, and speakers or headset for a spoken test.
  • For optional local execution, Python 3.13 or later and the dependencies in the sample README. The deployed sample uses the Python 3.13 runtime.

Initialize the sample

Sign in to Azure from the shell where you run the remaining commands:

azd auth login

Reference: Authenticate.

Initialize from the pinned sample manifest in an empty directory:

New-Item -ItemType Directory -Path hosted-voice-project
Set-Location hosted-voice-project
$template = "https://github.com/microsoft-foundry/foundry-samples/" +
    "blob/cb1c420dfcdf0be8614780ade6a8bf53796943f8/" +
    "samples/python/hosted-agents/bring-your-own/" +
    "voice-agent-target-agent/basic/azure.yaml"
azd ai agent init --template $template
Set-Location voice-live-bridge-basic-python

Reference: Initialize from an azure.yaml URL.

Select Create a new Foundry project, and then select your subscription and a supported region. Review the model version, deployment type, and capacity in azure.yaml before provisioning.

To reuse a shared project, add --project-id "<project-resource-id>" to the initialization command. Follow Reuse a shared Foundry project instead of the new-project provisioning step.

Review the target and voice wrapper

The sample declares two agent services in the same project:

Service Responsibility
voice-live-bridge-basic-python Runs the Python conversation logic and streams model response text through Bridge Protocol 1.0 over invocations_ws.
voice-live-bridge-basic-python-voice Provides the managed voice experience and sends conversation turns to the hosted target.

The hosted target declares invocations_ws version 1.0.0, with voiceLiveCompatible: "true" and bridgeProtocolVersion: "1.0" metadata. Keep these declarations for this sample.

The wrapper references the hosted service and includes it in uses:

uses:
  - ai-project
  - voice-live-bridge-basic-python
conversationEngine:
  type: hosted_agent
  name: voice-live-bridge-basic-python

Reference: Hosted conversation engine configuration.

The dependency deploys the hosted target before its wrapper. conversationEngine.version defaults to deployed, which pins the wrapper to the target version produced by this azd environment.

Keep model calls, tools, instructions, and conversation state in the target. Configure audio and greeting behavior on the wrapper. Don't add modelType: hosted_agent or targetAgent; those older fields aren't supported.

Provision and deploy both services

For the dedicated new project, select the model deployment used by the hosted code, provision the resources, and deploy both services:

azd env set AZURE_AI_MODEL_DEPLOYMENT_NAME gpt-5.4-mini
azd provision
azd deploy

Reference: azd provision | azd deploy.

Stop if provisioning or either deployment fails. Before testing model-backed turns, confirm that the hosted agent's identity has model-inference permissions on the parent Foundry resource. See Hosted agent permissions.

Read both agents and the wrapper endpoint:

azd ai agent show voice-live-bridge-basic-python --output json
azd ai agent show voice-live-bridge-basic-python-voice --output json
azd ai agent endpoint show voice-live-bridge-basic-python-voice `
    --output json

Reference: Manage agents | Manage agent endpoints.

Confirm that the wrapper has a voice endpoint containing /endpoint/protocols/voice?api-version=v1. A caller connects to this endpoint, not directly to the hosted target's Bridge endpoint.

Test a spoken turn

Use the project URL printed by deployment, or open the Foundry portal.

  1. Open the project, and select Build > Agents.
  2. Select voice-live-bridge-basic-python-voice, not the hosted target.
  3. Open the playground, start a voice session, and allow microphone access.
  4. Say, "Reply with one short sentence."
  5. Confirm an input transcript, a completed nonempty model response, and audible agent output.
  6. End the session.

azd ai agent invoke isn't a voice client. The standard Agent Inspector doesn't generate this sample's Bridge events. For an optional local protocol check, follow the smoke-client instructions in the sample README.

Reuse the existing environment

To reuse the dedicated project you created earlier, stay in the directory that contains its azure.yaml file and run:

azd init

Reference: azd init.

Choose to reuse the existing environment. Don't create another agent or Foundry project. Run azd provision and azd deploy again, and then repeat both agent reads and the spoken-turn check. Don't clean up the first deployment before this check.

Reuse a shared Foundry project

When initializing against an existing project, use a separate working directory and supply its full resource ID with --project-id. Check that the sample's two agent names don't collide with agents you need to preserve.

Set AZURE_AI_MODEL_DEPLOYMENT_NAME to an existing compatible Responses-model deployment in that resource, and then run azd deploy. Don't run azd provision or azd up: the sample's new-project declaration can create another model deployment and consume quota.

Confirm the required access permissions before deployment and the hosted identity's model access before testing. Reusing an existing agent name creates a new version of that agent.

Clean up resources

If you added phone bindings, disconnect them first. Delete the wrapper before the hosted target:

azd ai agent delete voice-live-bridge-basic-python-voice
azd ai agent delete voice-live-bridge-basic-python

Reference: Manage agents.

For a dedicated project created by this walkthrough, remove its resources:

azd down

Reference: azd down.

Warning

For an environment that created the project, azd down deletes its resource group and everything in it. Skip this command for a shared project. Preserve shared model deployments and other agents.