Add Voice Agents to Foundry Python SDK (generated code + REST) - #48956
Add Voice Agents to Foundry Python SDK (generated code + REST)#48956xitzhang (xitzhang) wants to merge 1 commit into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Part-one regeneration and live tests currently depend on the deferred realtime client, while the new sample installation commands do not select the beta package.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds preview Voice Agent REST/CRUD, conversation, telephony, samples, tests, and supporting generated API metadata to azure-ai-projects.
Changes:
- Adds Voice Agent models and operation groups.
- Adds management, conversation, and telephony samples/tests.
- Introduces beta release metadata and live-test resources.
File summaries
| File | Description |
|---|---|
tsp-location.yaml.saved |
Updates TypeSpec source commit. |
tests/test_base.py |
Adds sanitized voice model setting. |
tests/samples/test_samples.py |
Adds sync voice sample coverage. |
tests/samples/test_samples_async.py |
Adds async voice sample coverage. |
tests/samples/llm_instructions.py |
Reformats validation instructions. |
tests/foundry_features_header/test_foundry_features_header_on_ga_operations.py |
Tests header casing. |
tests/foundry_features_header/test_foundry_features_header_on_ga_operations_async.py |
Tests async header casing. |
tests/foundry_features_header/test_agent_telephony_protocol.py |
Tests sync telephony requests. |
tests/foundry_features_header/test_agent_telephony_protocol_async.py |
Tests async telephony requests. |
tests/foundry_features_header/foundry_features_header_test_base.py |
Adds Voice Agent header cases. |
tests/conftest.py |
Adjusts recording sanitizers. |
tests/agents/test_voice_agent_telephony.py |
Adds skipped sync telephony tests. |
tests/agents/test_voice_agent_telephony_campaign.py |
Adds skipped campaign tests. |
tests/agents/test_voice_agent_telephony_campaign_async.py |
Adds skipped async campaign tests. |
tests/agents/test_voice_agent_telephony_async.py |
Adds skipped async telephony tests. |
tests/agents/test_voice_agent_crud.py |
Tests sync Voice Agent CRUD. |
tests/agents/test_voice_agent_crud_async.py |
Tests async Voice Agent CRUD. |
tests/agents/test_voice_agent_conversations.py |
Tests recorded conversation reads. |
tests/agents/test_voice_agent_conversations_async.py |
Tests async conversation reads. |
tests.yml |
Adds live-test pipeline. |
test-resources.bicep |
Provisions Foundry test resources. |
test-resources-post.ps1 |
Deploys the realtime test model. |
samples/hosted_agents/sample_session_log_stream.py |
Explicitly enables streaming. |
samples/hosted_agents/sample_session_log_stream_async.py |
Enables async streaming. |
samples/agents/voice/sample_voice_agent_with_tools.py |
Demonstrates Voice Agent tools. |
samples/agents/voice/sample_voice_agent_versions.py |
Demonstrates version management. |
samples/agents/voice/sample_voice_agent_read_conversation.py |
Demonstrates transcript reads. |
samples/agents/voice/sample_voice_agent_read_conversation_audio.py |
Demonstrates audio reads. |
samples/agents/voice/sample_voice_agent_generate.py |
Demonstrates guided authoring. |
samples/agents/voice/sample_voice_agent_basic.py |
Demonstrates sync lifecycle. |
samples/agents/voice/sample_voice_agent_basic_async.py |
Demonstrates async lifecycle. |
samples/agents/sample_workflow_multi_agent_with_mcp_approval.py |
Updates type suppressions. |
samples/agents/sample_workflow_multi_agent_async.py |
Updates async type suppressions. |
README.md |
Lists Voice Agent samples. |
pyproject.toml |
Marks release as beta. |
PostEmitter.ps1 |
Adds generation customizations. |
docs/public-methods.md |
Documents new operations. |
CHANGELOG.md |
Describes the preview release. |
operations/_patch.py |
Exports conversation customization. |
operations/_patch_evaluators.py |
Updates generated JSON typing. |
operations/_patch_evaluation_rules.py |
Adds type suppressions. |
operations/_patch_datasets.py |
Updates generated JSON typing. |
operations/__init__.py |
Exports new operation groups. |
models/_patch.py |
Adds Voice feature headers and model fix. |
aio/operations/_patch.py |
Exports async conversation customization. |
aio/operations/_patch_evaluators_async.py |
Updates async evaluator typing. |
aio/operations/_patch_evaluation_rules_async.py |
Adds async type suppressions. |
aio/operations/_patch_datasets_async.py |
Updates async dataset typing. |
aio/operations/__init__.py |
Exports async operation groups. |
aio/_patch.pyi |
Updates async stubs. |
aio/_patch.py |
Adds headers and decompression workaround. |
aio/_client.py |
Wires async operation groups. |
_version.py |
Sets version 2.7.0b1. |
_utils/utils.py |
Adds ETag helpers. |
_unions.py |
Adds Voice Agent unions. |
_patch.pyi |
Updates sync stubs. |
_patch.py |
Adds telephony preview headers. |
_client.py |
Wires sync operation groups. |
assets.json |
Updates test asset tag. |
api.metadata.yml |
Updates API snapshot metadata. |
.env.template |
Documents Voice Agent variables. |
Review details
- Files reviewed: 68/72 changed files
- Comments generated: 11
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| $realtimeFiles = @('azure\ai\projects\_realtime.py', 'azure\ai\projects\aio\_realtime.py') | ||
| foreach ($f in $realtimeFiles) { | ||
| if (-not (Test-Path $f)) { | ||
| throw "PostEmitter safety check failed: '$f' is missing. This hand-written file (not tracked by the TypeSpec emitter) carries the SDK client-identification fix from PR #48848; if the emitter deleted or renamed it, restore it from git history before continuing." | ||
| } |
| ) | ||
|
|
||
| conversation_id: Optional[str] = None | ||
| with project_client.realtime.connect(agent_name=_AGENT_NAME) as conn: |
| ) | ||
|
|
||
| conversation_id: Optional[str] = None | ||
| async with project_client.realtime.connect(agent_name=_AGENT_NAME) as conn: |
|
|
||
| Before running the sample: | ||
|
|
||
| pip install "azure-ai-projects>=2.0.0" python-dotenv |
|
|
||
| Before running the sample: | ||
|
|
||
| pip install "azure-ai-projects>=2.0.0" aiohttp python-dotenv |
|
|
||
| Before running the sample: | ||
|
|
||
| pip install "azure-ai-projects>=2.0.0" python-dotenv |
|
|
||
| Before running the sample: | ||
|
|
||
| pip install "azure-ai-projects>=2.0.0" python-dotenv |
|
|
||
| Before running the sample: | ||
|
|
||
| pip install "azure-ai-projects>=2.0.0" python-dotenv |
|
|
||
| Before running the sample: | ||
|
|
||
| pip install "azure-ai-projects>=2.0.0" python-dotenv |
| EnvVars: | ||
| AZURE_TEST_RUN_LIVE: 'true' | ||
| AZURE_TEST_USE_CLI_AUTH: 'true' | ||
| TestMarkArgument: 'live_test_only' |
[Pilot] PR Pipeline Failure AnalysisWhat failedBuild 6809773 ( 1. Spelling check (Build Analyze job) — validation failure, fixable 2. Test-proxy playback failures — 4,584 failures (~382 unique tests × 6 platforms × 2 wheel/sdist variants), infrastructure/recording pattern raised from 3. New voice-agent test failures — 48 + 24 failures, code-fixable
Relevant pipeline outputRecommended next steps
Automated fix: Requested
|
Adds Voice Agents, a new agent kind for speech-to-speech conversational AI, unified with the rest of the Agents API: - Voice agent definition (kind="voice" on AgentDefinition), managed through the standard project_client.agents CRUD surface (create_version, get, list, disable/enable, delete) and guided authoring via generate_agent. - The agent_endpoint_conversations operation group for reading back persisted voice-agent conversation transcripts and audio. - Telephony bindings (Teams Phone, Twilio) and outbound telephony call jobs/campaigns through the new agent_telephony operation group. - WebRTC transport, sub-agent consultation, and conversation-engine delegation on the voice agent definition. This is part 1 of 2: generated code plus the REST/CRUD hand-written support (samples, tests, telephony header wiring). Part 2, adding the hand-written realtime WebSocket streaming client (client.realtime / async_client.realtime), is a follow-up PR based on this branch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7aa5ee1 to
b76c1ab
Compare
Summary
Adds Voice Agents, a new agent kind for speech-to-speech conversational AI, unified with the rest of the Agents API. This PR is part 1 of 2: generated code plus the REST/CRUD hand-written support. Part 2 (hand-written realtime WebSocket streaming client) is a follow-up PR based on this branch: #48957.
This is a split of #48939 into two independently reviewable pieces, at the requester's request, so the generated/REST surface and the hand-written streaming client can be reviewed separately. #48939 itself is untouched.
What's included
kind="voice"onAgentDefinition: model, audio input/output, turn detection, greeting, tools, and avatar configuration. Managed like any other agent throughproject_client.agents(create_version,get,list,disable/enable,delete), with guided authoring viagenerate_agent.agent_endpoint_conversationsoperation group for reading back persisted voice-agent conversation transcripts and audio.agent_telephonyoperation group.samples/agents/voice/for the management lifecycle, guided authoring, richer definitions, versioning, and reading back persisted conversations/audio.Foundry-Featuresopt-in header.Validation
sample_workflow_multi_agent.py)Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com