Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Deploy a GPT Live voice agent in Microsoft Foundry by using a complete azure.yaml template and the Azure Developer CLI (azd). The GPT Live Responses-delegation sample creates a spoken English tutor that delegates grammar questions to a Responses-model deployment.
GPT Live uses kind: voice with subProtocol: live. It doesn't add a new agent kind or initialization choice. Its native Live audio and event protocol differs from the Voice Live path used by the prompt voice quickstart.
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.agents1.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 on Windows for the commands in this article.
An existing Foundry project with voice-agent and GPT Live service access enabled in a supported subscription and region.
The project's full Azure resource ID. Copy Resource ID from Manage > Project details in the Foundry portal.
Existing compatible GPT Live and Responses-model deployments in the parent Foundry resource. Confirm that both deployments succeeded and that you have permission to invoke them.
Foundry User on the project, or equivalent agent create, read, invoke, and delete permissions. Resource discovery also requires Azure Resource Manager Reader access on the project and parent account.
Important
The Foundry RBAC roles were recently renamed. Foundry User, Foundry Owner, Foundry Account Owner, and Foundry Project Manager were previously named Azure AI User, Azure AI Owner, Azure AI Account Owner, and Azure AI Project Manager. You might still see the previous names in some places while the rename rolls out. The role IDs and core permissions are unchanged by the rename.
Python 3.11 or later, the Azure CLI, and the audio dependencies described in the sample README.
A microphone and speakers or headset for an interactive test.
Initialize from the full template
Authenticate in the shell where you run the walkthrough:
azd auth login
az login
Reference: Authenticate.
Replace <project-resource-id> with the existing project's full resource ID. Use a unique remote agent name to avoid creating a version of an agent that you need to preserve.
$projectId = "<project-resource-id>"
$agentName = "gpt-live-voice"
$serviceName = "gpt-live-response-delegation"
$template = "https://github.com/microsoft-foundry/foundry-samples/" +
"blob/main/samples/python/voice-agents/gpt-live/azure.yaml"
New-Item -ItemType Directory -Path gpt-live-project
Set-Location gpt-live-project
azd ai agent init --template $template `
--agent-name $agentName --project-id $projectId
Set-Location $agentName
Reference: Initialize from an azure.yaml URL.
$serviceName is the local service key in azure.yaml. $agentName is the remote Foundry agent name. Use the service key for the project-scoped azd commands below.
Configure the model deployments
In the generated azure.yaml, locate the gpt-live-response-delegation service. Replace only model.id and delegation.responses.model with your existing deployment names. The sample defaults are gpt-live-1 and gpt-5.6-terra; deployment names can differ from model names.
The relevant service fields use this structure. Keep the generated project service, uses dependency, and instructions:
kind: voice
subProtocol: live
modelType: self_deployed
model:
id: <live-model-deployment-name>
store: false
audio:
format:
type: audio/pcm
rate: 24000
output:
voice: marin
delegation:
type: responses
responses:
model: <responses-model-deployment-name>
instructions: >-
Correct the learner's sentence, explain the grammar briefly,
and give one example.
Reference: GPT Live voice service configuration.
The Live model handles the spoken conversation. The Responses model supplies backend guidance when the voice agent delegates a grammar question. The native audio shape uses audio.format and a string output voice; don't copy Voice Live's audio.input or Azure voice-tuning fields into it.
Deploy and inspect the agent
Deploy to the existing project, and then read the definition and endpoint:
azd deploy $serviceName
azd ai agent show $serviceName --output json
azd ai agent endpoint show $serviceName --output json
azd env get-value FOUNDRY_PROJECT_ENDPOINT
Reference: azd deploy | Manage agents.
Don't run azd provision or azd up for this existing-project path. This sample references existing model deployments; it doesn't provision GPT Live models for you.
Confirm that the saved definition has sub_protocol: live and that the callable voice endpoint ends with /endpoint/protocols/voice/live/sessions?api-version=v1. Don't connect this definition to the ordinary /endpoint/protocols/voice route.
Connect with the sample client
Use client.py and its dependency files from the complete sample. From the directory containing those files, create a virtual environment and copy the environment template:
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
Copy-Item .env.example .env
Reference: GPT Live sample client setup.
Set these values in .env:
| Variable | Value |
|---|---|
FOUNDRY_PROJECT_ENDPOINT |
The endpoint printed by azd env get-value FOUNDRY_PROJECT_ENDPOINT. |
AGENT_NAME |
Your remote $agentName, not the local service key. |
AZURE_SUBSCRIPTION_ID |
The subscription that owns the project. Read it with azd env get-value AZURE_SUBSCRIPTION_ID from the azd project directory. |
The client uses your signed-in Azure CLI identity. Don't add API keys or commit .env.
Run the interactive client:
.\.venv\Scripts\python.exe .\client.py
Reference: GPT Live sample client.
- Wait for the session to start. Foundry owns
session.start; the client waits forsession.started. - Say, "Please correct: He go to school every day."
- Confirm input and output transcripts, an audible correction, and a completed Responses delegation with nonempty backend guidance.
- Press Ctrl+C and confirm that the client closes without a protocol error.
Backend guidance and spoken output are separate event streams. A transcript alone doesn't verify audible output or successful delegation. For repeatable WAV-based checks with correlated delegation evidence and session.closed, follow the sample's client instructions.
azd ai agent invoke isn't a native Live audio client. Use the maintained sample client rather than a text invocation.
Understand the limitations
This Foundry agent path uses native Live over WebSocket. Don't add Voice Live-only fields such as conversationEngine, avatar, telephony, input transcription or VAD settings, root tools, or outputModalities. This agent path doesn't support WebRTC.
GPT Live requires modelType: self_deployed; a managed-model setting doesn't create a compatible deployment. You still need service access, model availability, and quota even when CLI voice commands are enabled.
The sample sets store: false. Don't assume it creates a persisted Foundry conversation or call recording.
Clean up resources
Return to the directory containing the generated azure.yaml. Read the deployed agent's actual name before deletion, because the local service key can differ from the remote name:
$agentJson = azd ai agent show $serviceName --output json
if ($LASTEXITCODE -ne 0) { throw "Couldn't read the deployed agent." }
$agentName = [string](
$agentJson | ConvertFrom-Json -ErrorAction Stop
).name
if ([string]::IsNullOrWhiteSpace($agentName)) {
throw "The deployed agent name is missing. Stop without deleting anything."
}
$projectEndpoint = azd env get-value FOUNDRY_PROJECT_ENDPOINT
if ($LASTEXITCODE -ne 0 -or
[string]::IsNullOrWhiteSpace($projectEndpoint)) {
throw "The project endpoint is missing. Stop without deleting anything."
}
azd ai agent delete $serviceName
if ($LASTEXITCODE -ne 0) { throw "Agent deletion failed." }
Reference: Manage agents.
Confirm deletion through the Agent GET API rather than relying on portal availability. Continue in the same PowerShell session and require HTTP 404 Not Found:
$token = az account get-access-token `
--scope https://ai.azure.com/.default --query accessToken -o tsv
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($token)) {
throw "No access token returned. Sign in with az login and try again."
}
$uri = $projectEndpoint.TrimEnd("/") + "/agents/" +
[uri]::EscapeDataString($agentName) + "?api-version=v1"
$headers = @{
Authorization = "Bearer $token"
"Foundry-Features" = "VoiceAgents=V1Preview"
}
$response = Invoke-WebRequest -Method Get -Uri $uri -Headers $headers `
-SkipHttpErrorCheck -MaximumRedirection 0 -ErrorAction Stop
if ([int]$response.StatusCode -ne 404) {
throw "Expected HTTP 404 after deletion; got $($response.StatusCode)."
}
Write-Output "Agent deletion confirmed (HTTP 404)."
Reference: Get an agent.
HTTP 200 means the agent still exists. Treat any other status, including authentication or authorization errors, as a verification failure. Resolve the error and repeat the GET check; don't treat a failed request as proof of deletion.
Preserve the existing project and both model deployments. Don't run azd down against this shared project.