Skip to content

Python: DevUI audio input and response playback - #9462

Draft
Fernando de Oliveira (fedeoliv) wants to merge 15 commits into
microsoft:mainfrom
fedeoliv:feature/devui-voice-input
Draft

Fernando de Oliveira (fedeoliv) wants to merge 15 commits into
microsoft:mainfrom
fedeoliv:feature/devui-voice-input

Conversation

@fedeoliv

@fedeoliv Fernando de Oliveira (fedeoliv) commented Oct 16, 2026 •

Copy link
Copy Markdown

Motivation & Context

DevUI can render text conversations and file attachments, but it did not provide a complete path for testing agents that accept audio input or return audio output. This change adds that path so developers can test audio-capable agents directly in DevUI without building a custom UI.

The feature adds browser microphone recording with push-to-talk, preview before send, audio upload handling, audio response playback, optional auto-stop on silence, and clearer audio settings.

Description & Review Guide

  • What are the major changes?

    • Adds microphone recording in DevUI chat with WAV normalization before sending. Supports WAV and MP3 uploads as agent audio input.

      image
    • Recording UX: push-to-talk, live mic level feedback, fixed-size recording layout, and optional auto-stop on silence.

      image image
    • Adds reusable audio preview and playback UI with waveform rendering, scrubber support, removal, download, and optional auto-play for agent audio responses.

      image
    • Adds audio settings under Settings, grouped into Input, Auto-stop on silence, and Output sections.

      image
    • Adds backend mapping for audio request and response content through DevUI conversations, executor handling, and OpenAI-compatible response mapping.

    • Adds tests for audio content mapping, conversation persistence, and multimodal workflow behavior.

    • Updates DevUI documentation with user-facing voice input guidance.

  • What is the impact of these changes?

    • Developers can test audio-capable agents from the DevUI chat surface.
    • Text-only agents continue to work as before.
    • Audio input is sent after the browser finishes a recording or upload. This PR does not add support for the OpenAI Realtime API, realtime audio streaming, or duplex voice sessions.
    • DevUI does not transcribe audio. The selected agent or model must handle audio input.
    • OpenAI's stateful Conversations schema does not currently model audio input as conversation content, so audio should be routed through an audio-capable agent/backend path rather than relying on OpenAI proxy conversation persistence.
    • Microphone recording depends on browser support and requires localhost or HTTPS.
    • Uploaded audio input is limited to WAV and MP3.
    • Auto-stop on silence is optional because microphone levels vary by browser, device, and room noise.
  • What do you want reviewers to focus on?

    • Whether the OpenAI-compatible audio content mapping matches expected request and response shapes.
    • Whether conversation persistence keeps audio content usable across turns without changing text-only behavior.
    • Whether the recording and preview UI is accessible, responsive, and clear enough for DevUI users.
    • Whether the audio settings are named and grouped at the right level of detail.
    • Whether the limitations are clear enough in the README.

Related Issue

Fixes #9359

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: GitHub Copilot assisted with implementation, testing, and UI refinements.

AI assistance details:

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label or add "[BREAKING]" to the title prefix, before or after any language prefix. A workflow keeps the label and title prefix in sync automatically.

Send microphone recordings and uploaded WAV/MP3 files as input_audio content without transcription.
Render agent audio outputs with preview, download, and optional autoplay while preserving DevUI media output items in final responses.

Refine microphone startup behavior and audio settings copy for a less noisy chat experience.
Add push-to-talk, live input level, optional silence auto-stop, clearer audio settings, and tighter recording/preview layouts.
Copilot AI balanced review requested due to automatic review settings October 16, 2026 15:48
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved recording lifecycle and audio-handling defects can leave microphone capture active, disable the composer, or lose audio content.

6 open findings
What changed in this PR

Adds audio input and response playback to Python DevUI, enabling developers to test audio-capable agents through the existing chat interface.

Changes:

  • Adds microphone recording, WAV/MP3 uploads, previews, playback controls, and audio settings.
  • Extends request mapping, response handling, and conversation persistence for audio.
  • Adds backend tests and user-facing documentation.
File Description
python/​packages/​devui/​tests/​devui/​test_multimodal_workflow.py Tests audio input conversion and format rejection.
python/​packages/​devui/​tests/​devui/​test_mapper.py Tests streamed and aggregated audio output.
python/​packages/​devui/​tests/​devui/​test_conversations.py Tests audio persistence round trips.
python/​packages/​devui/​README.md Documents audio features and limitations.
python/​packages/​devui/​frontend/​src/​types/​openai.ts Adds audio content and auto-play types.
python/​packages/​devui/​frontend/​src/​types/​agent-framework.ts Adds structured audio input types.
python/​packages/​devui/​frontend/​src/​stores/​devuiStore.ts Persists audio preferences.
python/​packages/​devui/​frontend/​src/​hooks/​use-audio-recorder.ts Implements capture, WAV normalization, and analysis.
python/​packages/​devui/​frontend/​src/​hooks/​index.ts Exports audio utilities.
python/​packages/​devui/​frontend/​src/​components/​ui/​file-upload.tsx Restricts audio selection to WAV/MP3.
python/​packages/​devui/​frontend/​src/​components/​ui/​chat-message-input.tsx Integrates recording and audio attachments.
python/​packages/​devui/​frontend/​src/​components/​ui/​audio-message-preview.tsx Adds recording and playback controls.
python/​packages/​devui/​frontend/​src/​components/​layout/​settings-modal.tsx Exposes audio settings.
python/​packages/​devui/​frontend/​src/​components/​features/​agent/​message-renderers/​OpenAIMessageRenderer.tsx Passes audio auto-play flags.
python/​packages/​devui/​frontend/​src/​components/​features/​agent/​message-renderers/​OpenAIContentRenderer.tsx Renders audio previews and players.
python/​packages/​devui/​frontend/​src/​components/​features/​agent/​agent-view.tsx Integrates audio into chat messages.
python/​packages/​devui/​agent_framework_devui/​models/​_openai_custom.py Adds extension-compatible response models.
python/​packages/​devui/​agent_framework_devui/​models/​__init__.py Exports custom response models.
python/​packages/​devui/​agent_framework_devui/​_server.py Serializes extended conversation items.
python/​packages/​devui/​agent_framework_devui/​_mapper.py Preserves audio in mapped responses.
python/​packages/​devui/​agent_framework_devui/​_executor.py Converts structured audio into agent content.
python/​packages/​devui/​agent_framework_devui/​_conversations.py Adds audio conversation serialization.
python/​packages/​devui/​agent_framework_devui/​_audio.py Centralizes audio format helpers.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/packages/devui/agent_framework_devui/_conversations.py
Comment thread python/packages/devui/frontend/src/hooks/use-audio-recorder.ts
Comment thread python/packages/devui/frontend/src/hooks/use-audio-recorder.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread python/packages/devui/agent_framework_devui/_conversations.py Outdated
Comment thread python/packages/devui/frontend/src/hooks/use-audio-recorder.ts Outdated
Enhance audio content check to include additional conditions.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Restore the OpenAI response alias to the SDK Response type and remove custom completed/failed event models so the audio backend changes stay localized to DevUI extension output items.

Keep typed input_audio parsing for pyright and preserve audio conversion behavior without changing the OpenAI proxy executor contract.

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

Copilot-Session: 259add50-0116-466a-9cbe-3ac3983977d4
Restore the conversation test to assert input_audio round-trip behavior instead of relying on the internal item representation, and keep mapper assertions compatible with the stricter typing checks used in CI.

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

Copilot-Session: 259add50-0116-466a-9cbe-3ac3983977d4
Restore the existing arg-type ignore comments around DevUI output item constructors while keeping the custom output item event required for runtime validation of extension output items.

Narrow the conversation audio round-trip test helper so CI typing checkers accept both dict and model-backed conversation items.

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

Copilot-Session: 259add50-0116-466a-9cbe-3ac3983977d4
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 259add50-0116-466a-9cbe-3ac3983977d4

This branch was successfully deployed

1 active deployment
github-app-auth — 288b5431 Deployed Oct 16, 2026 by fedeoliv via add_label #25644
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Feature]: DevUI voice input and audio responses

2 participants