Skip to content

Add Voice Agents realtime streaming client - #48957

Closed
xitzhang (xitzhang) wants to merge 1 commit into
xitzhang/voice-agents-autogenfrom
xitzhang/voice-agents-streaming
Closed

Add Voice Agents realtime streaming client#48957
xitzhang (xitzhang) wants to merge 1 commit into
xitzhang/voice-agents-autogenfrom
xitzhang/voice-agents-streaming

Conversation

@xitzhang

Copy link
Copy Markdown
Member

Summary

Adds the hand-written realtime WebSocket streaming client for Voice Agents. This PR is part 2 of 2, based on and pointing to #48956 (generated code + REST/CRUD support), which must merge first.

This is a split of #48939 into two independently reviewable pieces, at the requester's request. #48939 itself is untouched.

What's included

  • A new client.realtime / async_client.realtime entry point for realtime speech-to-speech streaming. Use with client.realtime.connect(agent_name=...) as connection: to open a WebSocket connection, connection.send(...) to send strongly-typed client events (or the connection.response, connection.conversation.item, and connection.session helpers), and iterate over connection to receive strongly-typed server events.
  • The new types Realtime, RealtimeConnection, and RealtimeConnectionManager (and async equivalents AsyncRealtime, AsyncRealtimeConnection, AsyncRealtimeConnectionManager) exported from azure.ai.projects / azure.ai.projects.aio.
  • These WebSocket clients identify themselves to the service the same way the generated HTTP surface does (User-Agent header, x-ms-client-sdk query parameter).
  • A new optional realtime extra (websockets for the sync client, aiohttp for the async client).
  • Samples demonstrating a live typed text conversation, a hands-free bidirectional audio conversation, and handling a client-executed function tool during a live session.
  • Mocked unit tests for the realtime client's WebSocket handshake/event plumbing, plus live-only integration tests for real conversations against a voice agent.

Validation

  • black: clean
  • pylint: 10.00/10
  • mypy: clean (only a pre-existing, unrelated issue in sample_workflow_multi_agent.py)
  • Full test suite: 1516 passed, 123 skipped, 0 failed
  • Verified the combined result of this PR + Add Voice Agents to Foundry Python SDK (generated code + REST) #48956 is byte-for-byte identical to the previously fully-tested combined branch (including regenerated api.md/api.metadata.yml/docs/public-methods.md)

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
11 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

Copy link
Copy Markdown
Azure Pipelines:
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@xitzhang
xitzhang (xitzhang) force-pushed the xitzhang/voice-agents-autogen branch from 7aa5ee1 to b76c1ab Compare September 10, 2026 10:17
Adds the hand-written realtime WebSocket streaming client for Voice
Agents, on top of the generated code and REST/CRUD support added in
xitzhang/voice-agents-autogen (part 1 of 2):

- A new client.realtime / async_client.realtime entry point. Use
  with client.realtime.connect(agent_name=...) as connection: to open
  a WebSocket connection, connection.send(...) to send strongly-typed
  client events, and iterate over connection to receive strongly-typed
  server events. The new types Realtime, RealtimeConnection, and
  RealtimeConnectionManager (and async equivalents) are exported from
  azure.ai.projects / azure.ai.projects.aio.
- Requires the optional websockets package for the sync client, or
  aiohttp for the async client (new [realtime] extra).
- Samples demonstrating live text and audio conversations, and
  client-executed function tools during a live session.
- Mocked unit tests for the realtime client, plus live-only integration
  tests for real conversations against a voice agent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant