Skip to content

feat(voice): dictation and voice mode in the Agent UI and TUI - #6789

Draft
kovtcharov wants to merge 54 commits into
amd:mainfrom
kovtcharov:kalin/voice-local
Draft

kovtcharov wants to merge 54 commits into
amd:mainfrom
kovtcharov:kalin/voice-local

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GAIA could read replies aloud but couldn't listen. Now you can dictate into the composer, or open a hands-free voice mode in both the Agent UI and the TUI. GAIA hears you, works, speaks a short summary, and keeps the full detail on screen. Everything runs locally through Lemonade (Moonshine or Whisper to hear, Kokoro to speak), and voice refuses to start against a remote Lemonade.

Design: docs/plans/voice.mdx (#6491). Builds on read-aloud (#6489).

  • One chat path. A voice turn is an ordinary message sent with reply_style: "voice", so it is saved, shown and stopped like a typed one. The flagship (contract 2.28) adds a per-turn note asking for a short, conversational <spoken> summary and status lines before tools. Typed turns and their cached prompt are unchanged.
  • Audio lives on the server. The Agent UI server, or the daemon for the TUI, holds the recognizer, chime, synthesis and turn-taking. Each app runs the turn.
  • A room is not a request (Agent UI). Live testing sent key clicks, coughs and a side conversation to the agent as turns, and any sound cut GAIA off. The session now measures how much of a sound was voiced and drops recognizer guesses; a sound only lowers her voice and real speech stops it; a half-sentence waits for the rest. In hands-free mode she answers when named ("Hey GAIA") or within twenty seconds of her last reply, and "we're not talking to you" sends her to standby.
  • Interrupting really stops her. Speech reaches the browser faster than it plays, so the app now tells the server while playback lasts and a new request always cuts the old answer.
  • Work isn't cancelled by talk. While a tool runs, only "stop", "wait" or "actually…" cancels it. A permission prompt is asked out loud and answered with yes or no. A picture a tool saves shows in voice mode.
  • She can change how she sounds. New flagship tool set_voice_setting (voice, speed, volume, captions, chime, wake word; 106 tools now). Anything else she refuses and points to Settings. The voice screen also gets a mute button and a menu for the same settings.
  • A dropped recognizer recovers. If Lemonade closes the recognizer or evicts its model, the session reopens it, and stops with an error if it keeps dropping, instead of sitting on "Listening".

Test plan

  • pytest tests/unit/voice tests/unit/chat/ui/test_voice_router.py tests/unit/chat/ui/test_relayed_reply_style.py tests/unit/test_daemon_voice_routes.py tests/unit/test_chat_tool_requests.py hub/agents/gaia/python/tests/test_server_reply_style.py hub/agents/gaia/python/tests/test_capability_matrix.py
  • GAIA_VOICE_TEST_LEMONADE=http://127.0.0.1:<port>/api/v1 pytest tests/integration/test_voice_realtime_lemonade.py against a local Lemonade
  • cd src/gaia/apps/webui && npm test && npm run test:rtl
  • cd tui && go test ./...
  • Agent UI, hands-free: say "Hey GAIA, what time is it?"; wait 15 s and speak without her name (nothing is sent); type on a keyboard while she talks (she keeps talking); say "stop" (she stops)
  • Ask "Hey GAIA, draw a red fox", talk while it runs (not cancelled, picture appears); ask for a command that needs approval and answer "yes"
  • "Hey GAIA, change your voice to George and speak slower" (next reply is in the new voice); mute button; settings menu
  • TUI: Ctrl+R dictation; /talk, any key interrupts
  • Next RC eval: gaia_voice_mode (gaia-signal lane); the voice-turn note and one new tool changed, so also watch gaia_voice, gaia_honesty, gaia_tool_selection
🔍 Technical details
  • New package src/gaia/voice/: listener, session, protocol, chunker, spoken splitter, PCM helpers, plus noise.py (voiced-sound meter, non-speech and looped-transcript checks), turns.py (turn-taking decisions) and settings.py (the five agent-settable settings).
  • Routes: WS /api/voice/session and /api/voice/{status,settings,models/download} in the UI server; /daemon/v1/voice/* in the daemon.
  • New config keys voice_wake_word (default on) and voice_volume (default 100), documented in docs/reference/cli.mdx.
  • The wake word matches the recognized text, not a dedicated keyword detector, so the name has to be transcribed.
  • Socket auth: the UI server checks host, origin and the mobile-access token itself, because the HTTP middleware never sees WebSocket scopes.
  • Noise thresholds were tuned on synthetic clicks and one live session with a mechanical keyboard; no recordings are stored, the server logs only voiced milliseconds and the decision.
  • Not done: the TUI and phone calls still use the old interrupt rule and have no wake word, standby or mute. Not verified: the packaged Electron app, a real phone over mobile access, real PortAudio capture in the daemon. Agent evals have not been run for the new note and tool.
  • Two test_full_tool_bundles tests fail on a machine without the browser extra, with or without this change.

huong8373tt-beep and others added 25 commits October 31, 2026 16:49
Adding Kokoro to the talk profile also put it in `gaia init --profile all`,
whose model check sent every non-embedding model a chat request, so a clean
install reported the voice model as broken. Init now recognises TTS models
from the model registry, checks them by synthesizing one word, and labels
them "speech" in `gaia init --check --load`.

The docs now say to run `gaia download --agent talk` before asking the agent
to read aloud, since the tool no longer downloads Kokoro itself.
Replies can now be heard: a speaker button on each Agent UI reply and
/read-aloud in the TUI speak them through Lemonade's Kokoro voice, in a
voice, speed and auto-read choice both apps share via ~/.gaia/config.json.

- Backend: GET/PUT /api/speech/settings and POST /api/speech (WAV), with
  503/502/422 that say what failed; read_aloud_voice/speed/auto config
  keys validated by gaia config.
- Agent UI: per-reply button, Settings > Read aloud (voices grouped by
  accent and gender, Preview, speed, auto-read), markdown stripped and
  long replies spoken in pieces with the next fetched ahead.
- TUI: /read-aloud and /voice, playback through the OS player, voice
  list embedded and pinned to KOKORO_VOICES by a drift test.
A fetch still running after Speak returned read the package-level
folder while a test reset it, which the race detector caught on Linux
and macOS CI.
…h tool

Merges amd#6204 (the flagship text_to_speech tool) under read-aloud so GAIA
has one way to make speech: the same Lemonade client, voice list and
speed range, and the voice and speed the user picks for reading aloud.

- text_to_speech now defaults to read_aloud_voice and read_aloud_speed
  from ~/.gaia/config.json when the request names neither.
- Its speed bounds come from READ_ALOUD_MIN_SPEED/MAX_SPEED, the range
  the settings already enforce.
The speed menu's "Normal" carried the bracketed English hint, which an
<option> can't style and which scrambles in rtl; option text now uses
t.bare. The error detail used dir="auto", which pushed English 210px off
the row's edge in Arabic; it is a <bdi> now. The rtl audit gains a rule
for <option> text so the first can't come back.
# Conflicts:
#	hub/agents/gaia/npm/CHANGELOG.md
#	hub/agents/gaia/python/gaia_agent/chat_agent.py
#	hub/agents/gaia/python/tests/test_chat_tts_tool.py
#	src/gaia/audio/lemonade_tts.py
Main's new Settings layout came with fresh reference screenshots that predate
this branch's Read aloud section in the sidebar.
# Conflicts:
#	src/gaia/apps/webui/src/components/ChatView.tsx
#	src/gaia/apps/webui/src/components/settings/SettingsDialog.css
#	src/gaia/apps/webui/src/components/settings/SettingsDialog.tsx
#	src/gaia/apps/webui/visual/__screenshots__/settings-general-dark-win32.png
#	src/gaia/apps/webui/visual/__screenshots__/settings-general-light-win32.png
# Conflicts:
#	hub/agents/gaia/npm/CHANGELOG.md
# Conflicts:
#	src/gaia/apps/webui/src/components/ChatView.tsx
# Conflicts:
#	hub/agents/gaia/python/tests/test_chat_tts_tool.py
# Conflicts:
#	src/gaia/apps/webui/src/components/ChatView.tsx
…ntract

GAIA could speak replies but not listen. This adds the server half of
dictation and voice mode: a session that streams the microphone to
Lemonade's realtime recognizer, plays a chime when you stop talking, speaks
the text the app hands it clause by clause, and drops queued speech the
moment you interrupt.

- gaia.voice: realtime listener, clause chunker, <spoken> splitter, PCM and
  G.711 helpers, the host-agnostic socket protocol. Refuses a remote Lemonade.
- Agent UI server: GET /api/voice/status, POST /api/voice/models/download
  (voice models only), WS /api/voice/session with host, origin and
  mobile-access token checks.
- Voice turns go through the normal chat path with reply_style "voice". The
  flagship (API 2.28) adds a per-turn note asking for a short <spoken> summary
  and status lines. An older flagship gets a clear "update GAIA" error.
- Validated voice_* config keys.
The Agent UI and TUI each split <spoken> out of the answer stream, so one
JSON case file now pins the behaviour all three parsers must match,
including the reset when a tool step starts.
…hesis

Tested against a real Lemonade 2026.44.1. Its realtime endpoint never loads
a model, so the first dictation failed with "No model loaded". The listener
now loads the recognizer first, as Lemonade's own example does.

Kokoro takes 0.4-0.8 s per clause here, and streaming doesn't help: the first
byte arrives only when the clause is done. So the next clause is now
synthesized while the current one plays, and a real-time speaker never waits
between clauses.

Adds an integration test against a real Lemonade, run when
GAIA_VOICE_TEST_LEMONADE is set. Kokoro speaks a sentence and the
recognizer hears it back, starting from a recognizer that isn't downloaded.
Voice turns had no eval. The Agent UI MCP's send_message takes
reply_style, and three scenarios check that a voice turn opens with a short
plain spoken summary, narrates tool steps honestly, and says a failure out
loud. They run in the gaia-signal lane on the next RC.

The flagship's README, SPEC, SKILL, CHANGELOG and OpenAPI artifact now
describe reply_style (contract 2.28) and alert_owner.
The TUI could read replies aloud but not listen. Ctrl+R (or /dictate) now
dictates into the composer, and /talk opens a hands-free voice mode with a
shimmering state line, a level meter, captions and the work log. The GAIA
daemon records the microphone and plays speech, so the Go build stays free of
cgo and audio libraries.

- Daemon: /daemon/v1/voice/{status,devices,models/download,session} behind
  the client token. Capture pauses while speech plays, since the daemon has
  no echo cancellation (amd#3494), and any key interrupts. A missing,
  denied or busy mic is a stable error code with a message. Without
  `websockets` the routes say so instead of 404ing. The [api] extra gains
  websockets and sounddevice.
- TUI: a voice turn goes through the chat's normal query path with
  reply_style "voice" (flagship 2.28+, refused before voice mode opens on an
  older one). The Go splitter passes the shared spoken-split cases. Spoken
  summaries show as a bold lead line in the history. Push-to-talk is Space to
  start and Space to send, because terminals don't report key release.
- Adds github.com/coder/websocket (ISC, pure Go).
- Lint fixes in gaia.voice, and the live-Lemonade voice test is allowlisted
  for CI lanes with its reason.
The Agent UI could read replies aloud but not listen. A mic button now
dictates into the composer, with live partials in the box, and when the box
is empty the send button opens voice mode. Voice mode is a hands-free screen
with a listening ring and a speaking glow that follow the live audio, a
shimmering state word, captions, and a "What GAIA did" work log. Voice turns
are ordinary chat messages sent with reply_style "voice", so they are saved,
shown and stopped like typed ones. The spoken summary appears as a bold lead
line in the history.

- Barge-in flushes playback locally first. Permission cards show inside voice
  mode, and GAIA says it needs your OK. Arabic answers on screen with
  captions, since speech is English-only for now.
- Phone (mobile access): full-screen layout, tap to start audio, wake lock,
  pause when hidden, iOS play-and-record.
- Settings › Voice: listening and voice-mode groups next to read-aloud's
  speaking controls.
- Electron grants the microphone to the app's own page only. The macOS build
  gets the audio-input entitlement and usage text.
- Exports and search snippets show the spoken summary as text, without tags.
- Never uses the browser's SpeechRecognition or speechSynthesis; a test fails
  the build if the source mentions them.
…ession

Review fixes. After the 5-minute dictation limit, every mic frame sent another
limit event and commit. A TUI voice session whose send queue filled said it
was closed but stayed open. The voice routes now use GAIA's logger.
@github-actions github-actions Bot added documentation Documentation changes installer Installer changes dependencies Dependency updates mcp MCP integration changes labels Nov 6, 2026
…r name

Told "we're not talking to you", GAIA kept answering the room. She now
stands by and sends nothing until an utterance names her ("Hey GAIA"), and
an "um" followed by nothing is no longer a turn.
… on the voice screen

A conversation in the room was sent to GAIA line by line. In hands-free mode
she now answers when an utterance names her ("Hey GAIA") or within ten
seconds of her last reply. The voice screen gains a microphone mute button and
a menu for volume, voice, speed and the wake word; a new voice or speed is
used from the next reply.
…nd wake word

Asked to change her voice she could only make a sample file. A new tool,
set_voice_setting, saves one of five voice settings and refuses any other,
pointing the user to Settings. Voice mode re-reads the settings when a tool
finishes, so the change is heard in the same reply. Volume moves from the
browser's storage into the saved voice settings so she can set it too.
…ice, and count the new tool

The flagship now registers 106 tools; the manifests, capability matrix, guide
and skill playbook say so. The voice eval category added earlier is in the
matrix's expected list. Voice tests share one fixture through a conftest.
…picture row

The voice screen's tests stubbed the controller without the new mute and
volume functions, so every case in the file failed. The volume slider gets its
own accessible name.
Whisper wrote the wake phrase as "Hegaya", which the name match missed, so
the request was dropped.
…he chime is a setting

Speech reaches the browser faster than it plays, so the server thought GAIA
had finished while the room still heard her: talking over her started a new
turn but her old answer kept playing, and the new one queued behind it. The
app now tells the server while playback lasts, and a new request always cuts
the end of the last answer. The "heard you" tone is a setting (on by default)
that GAIA can change too. Speech ignored while waiting for her name now says
so, and the follow-up window is 20 seconds.
…" ends it

Follow-ups needed her name again after twenty seconds. The wake word is for
when it has been quiet: the window is now a minute after she last spoke, and
"GAIA, go to sleep", "good night" or "that's all" sends her back to
waiting for her name at once, whether or not the phrase names her.
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Nov 12, 2026
**This is the design the voice and phone work builds on** (amd#6789,
amd#6790). The plans ship no code, and they don't block or change current
release work.

GAIA can read a reply aloud, but neither the Agent UI nor the TUI can
listen. This plan covers two features:

- **Dictation:** talk into the composer, and the text lands in the box
for you to edit before sending.
- **Voice mode:** a hands-free screen of its own. GAIA speaks short
answers and keeps the full detail of what it did on screen: tool steps,
results and files.

It's built to feel instant and to stay 100% on the PC:
- small streaming models (Moonshine Streaming for English, Whisper for
other languages, Kokoro for speech, the chat model already loaded)
- one server-side voice session
- spoken status lines the model writes before each tool call
- a latency budget of about 1.5 s from the end of speech to GAIA talking

Arabic users get dictation, and voice mode answers them on screen until
an Arabic voice exists. The plan ends with a six-PR delivery sequence,
dictation first.

Refs amd#702, amd#372

## Test plan
- [ ] `python util/check_doc_links.py` passes
- [ ] The page renders under Roadmap › Agent UI on the Mintlify preview

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Conflicts: the capability matrix (regenerated: 106 tools) and the tool-request matcher, where main's media matches and the voice-setting match both stay.
… profile tool goldens

Three checks failed on this branch against current main: the SDK page did not mention the four voice routes, the committed API schema snapshot lacked the voice models, and the profile goldens did not list set_voice_setting, which every non-chat profile now registers. The goldens' prompts are unchanged; only the tool name is added.
Conflict: the chat view's send. Main made it report whether the message was taken; the voice turn's error signal is kept on each path that now returns false.
@kovtcharov
kovtcharov marked this pull request as ready for review November 12, 2026 08:31
@kovtcharov

kovtcharov commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Merged current main. I marked this ready, then put it back to draft once CI ran: the voice feature fails its own tests there, and that is feature work, not merge work.

What still fails in CI

  • Voice mode's visual tests (voice mode, every state, all 8 variants). While GAIA is speaking, pressing the big button does not stop her, and Escape does not close the voice screen. The same tests fail on this branch as it was before the merge, so it is not from main. Either the screen or the tests need to change to match the last voice commit.
  • The voice unit tests on Linux and Windows runners (tests/unit/voice/test_noise.py, test_voice_core.py): the session reports "Lemonade Server isn't reachable" at the test's own local port. They pass on a developer PC, so something in the runner's environment reaches the session that the tests do not pin.
  • One read-aloud test (test_playback_without_sounddevice_names_the_talk_extra) fails in CI and locally. This branch moves sounddevice into the daemon's dependencies, so check whether that changed the install hint the test expects.
  • One TUI daemon test failed once in CI and passes locally; likely timing.

What I did

  • Conflicts: the capability matrix (regenerated, 106 tools), the tool-request matcher (main's media matches and the voice-setting match both stay), and the chat view's send. Main made send report whether the message was taken, so the voice turn's error signal now sits on each path that returns false.
  • A real bug fixed: gaia.voice was not in the list of packaged modules, so an installed GAIA would have shipped without any voice code. Source checkouts hid it.
  • Checks that failed on this branch, now passing: the SDK page documents the voice settings, status and model-download routes; the API schema snapshot includes the voice models; two voice eval scenarios use the corpus's own tier tags; the profile goldens and the doc-profile tool baseline include set_voice_setting; the tool has a label for the Agent UI's activity rows; and the TUI's new WebSocket module is recorded in the licence check.

Three of those need a maintainer's yes, because the checks say so:

  1. The new tool is in every non-chat profile. The golden test asks for sign-off on a tool-set change. The prompts did not change.
  2. It costs about 145 tokens of prompt (text path 1,260 to 1,405; native 6,888 to 7,255). The baseline was re-measured, as that test asks, but 11% for one tool is worth a look at its description.
  3. The licence entry records github.com/coder/websocket as ISC. Its LICENSE.txt is the ISC text without a title line, which is why the scanner could not name it.

Locally on the merged branch: the test plan's Python suites pass, the webui unit suite passes and type-checks, go test ./... passes in tui, and black, isort and flake8 are clean.

@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

This PR adds dictation and a hands-free voice mode to the Agent UI and the TUI, running locally through Lemonade. The design is solid: a voice turn is an ordinary chat turn, and the voice socket checks host, origin and the mobile-access token itself. The new dependencies are permissively licensed. Four things should be fixed before merge:

  • Background goal runs can pick up voice style. A goal run on a session reuses that session's agent but never resets the reply style. After one voice turn, the next background run answers as if it were spoken: a short summary inside spoken tags, plus status lines. Reset the style to text on that path, the way the chat paths already do.
  • The TUI's voice session can hang when the speaker goes away. If the output device stops taking audio (unplugged, or the system drops it), the daemon waits forever to queue more speech. The turn freezes with no error. Add a deadline that ends the session with an error.
  • Some failures to start a voice session say nothing. A bad saved setting, or any error other than a voice error, closes the socket with no error message, so the user gets a dead voice screen with no reason. Report these the way voice errors are reported.
  • One doc still gives the old contract version. The GAIA agent guide still says the API is version 2.27.

Real-world evidence

N/A: no evidence bundle was produced for this run. The verdict rests on static review alone. The PR description also has no Agent UI screenshots, and no recorded run of the voice socket or the new /api/voice/* routes. Its live checks (wake word, barge-in, approvals by voice, TUI /talk) are all still unchecked.

🔍 Technical details

🟡 Background goal ticks keep a voice turn's reply style (src/gaia/ui/agent_loop.py:557)
The tick reuses the session's cached agent (_get_cached_agent, around line 509). It calls _apply_memory_state but not _apply_reply_style. So agent.reply_style stays "voice" after a voice turn, and ChatAgent.get_memory_dynamic_context adds VOICE_TURN_NOTE to the tick's prompt. The sidecar path resets the style every turn (server.py: agent.reply_style = request.reply_style or "text"), and so do both UI chat paths. This is the one in-process sibling that doesn't. I found it by grepping callers of _apply_memory_state.

                _helpers._apply_memory_state(agent, session, db)
                # A voice turn's note must not carry into a background tick.
                agent.reply_style = "text"

🟡 Speaker.write has no deadline (src/gaia/daemon/voice_routes.py:236-244)
write sleeps in 20 ms steps until the PortAudio callback drains the buffer below _max_ahead. If the output stream stops calling back (device removed, PortAudio stall), the loop never returns. Only an interrupt or flush from outside frees it. Bound the wait, for example at 2 s with no progress, and raise a VoiceError such as mic_missing/"speaker stopped", so the TUI shows an error instead of "Speaking" forever. (Missed-bug class: No deadline.)

🟡 Non-VoiceError failures in make_session end silently (src/gaia/voice/protocol.py:90)
run_voice_socket only turns a VoiceError into an error event. In both routers, make_session calls GaiaConfig.load(), which raises GaiaConfigError on a bad saved value. That error, and anything else raised while building the TTS client or the session, skips the except. The client then gets only closed, and the server logs a traceback. Catch GaiaConfigError (and other expected failures) and send an error event naming the cause and the fix. (Missed-bug class: Dishonest status.)

🟡 Docs drift: contract version (docs/guides/gaia.mdx:325)
It still reads "API version 2.27", but server.py, lifecycle.ts and the CHANGELOG are now at 2.28. The PR edits this file but missed that line.

🟡 Real-world evidence missing from the PR description
This is a user-visible Agent UI change (voice screen, mic button, settings). The rubric asks for embedded before/after screenshots from a live gaia chat --ui run. At minimum, include the recorded request and response for /api/voice/status and a socket session.

🟢 Nits

  • src/gaia/voice/settings.py:86: the docstring says "five settings", but AGENT_VOICE_SETTINGS has six (the tool docstring says six too).
  • hub/agents/gaia/npm/CHANGELOG.md:42 and :83: [Unreleased] now has two ### Added headings. Merge the contract-2.28 entry into the first one.
  • src/gaia/ui/routers/voice.py:274: the socket accepts the tunnel token from ?token=, which the HTTP TunnelAuthMiddleware doesn't do. A token in a URL ends up in proxy and ngrok request logs. The cookie already reaches a same-origin WebSocket, so consider dropping the query fallback.

Licences checked: websockets (BSD-3-Clause), sounddevice (MIT; its wheels bundle PortAudio, MIT), github.com/coder/websocket (ISC). None are copyleft.

Strengths

  • The WebSocket guard (socket_refusal) mirrors the HTTP host, origin and tunnel rules, which the HTTP middleware can't apply to WS scopes. The daemon socket uses a constant-time bearer check and sends a distinct 401 so the TUI can re-read a rotated token.
  • The Electron change goes from "grant every permission" to an allowlist: audio-only media for the app's own page, everything else denied.
  • set_voice_setting is narrowly scoped (six keys, validated values, refuses everything else). The relay checks the sidecar's contract version before sending reply_style, and fails loudly on an old agent.

gaia.voice was missing from setup.py's package list, so an installed (non-editable) GAIA would have had no voice code at all.

Also: the doc-profile tool baseline is re-measured for the added set_voice_setting tool (46 tools; the text prompt grows by about 145 tokens), two voice eval scenarios use the corpus's own tier tags, and the TUI's new WebSocket module is recorded as ISC from the licence text it ships.
Every tool the flagship registers needs a label for its activity row; this one had none, which fails the profile check.
@kovtcharov
kovtcharov marked this pull request as draft November 12, 2026 09:29
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

The new commits fix packaging, the licence check and the tool label, but none of the four 🟡 findings from the last review is fixed yet:

  • 🟡 Background goal runs can still pick up voice style. After one voice turn, the next background run on that session answers as if it were spoken.
  • 🟡 The TUI voice session can still hang if the speaker stops taking audio. The turn freezes with no error.
  • 🟡 Some failures to start a voice session still close it with no error message, for example a bad saved setting.
  • 🟡 The GAIA agent guide still says API version 2.27, but the code is now at 2.28.
🔍 Technical details

All checked against HEAD (f1ac736b3):

  • src/gaia/ui/agent_loop.py:557: still calls only _apply_memory_state, with no agent.reply_style = "text" reset after it.
  • src/gaia/daemon/voice_routes.py Speaker.write: still an unbounded while True / asyncio.sleep(0.02) loop with no deadline.
  • src/gaia/voice/protocol.py run_voice_socket: still catches only VoiceError. A GaiaConfigError from make_session reaches the client as a bare closed.
  • docs/guides/gaia.mdx:325: still reads "API version 2.27".

The suggested fixes in the previous review still apply.

@kovtcharov-amd kovtcharov-amd added enhancement New feature or request talk Talk agent changes agent-ui Agent UI changes labels Nov 12, 2026
kovtcharov-amd added a commit that referenced this pull request Nov 20, 2026
Getting a document as audio used to take two hand-described steps,
produced only WAV (3 minutes is 9 MB), and showed no player once the
file was saved to a folder of your own. Now one sentence does it in the
Agent UI and the TUI: attach or name a PDF, Word, Excel, text or
Markdown file, say "turn this into audio", and GAIA records it, plays it
in the chat, and saves the audio where you asked. It reads the document
as written, or rewrites tables, charts, footnotes and web addresses into
spoken sentences when it has them, says which it chose, and saves that
listening script beside the audio.

What a reviewer should weigh:

- **One tool does the whole job.** `dictate_document` reads the file
itself, so a long document is never shortened by passing through the
model, and a new `dictation` skill tells the agent to call it without
questions.
- **The player works for any save location, with the media boundary
intact.** The recording always stays in GAIA's audio folder and a copy
goes to the user's path; `text_to_speech` now does the same. The only
change to what the Agent UI serves is `.mp3`.
- **MP3 needs nothing new.** It is Lemonade's own encoding of the Kokoro
voice, joined frame by frame: 3 min 16 s is 3.9 MB against about 9 MB as
WAV. A lower bitrate would need ffmpeg and is left out.
- **Long documents show progress and stop cleanly** in both apps. The
TUI's live line now shows a running tool's own progress, which also
benefits other long tools.
- **A rewrite cannot change a number.** Every figure in a listening
script is checked against the document before recording. Gemma 4 E4B
wrote 13,110 for 13,100 on the test report; that is now asked for once
more and, if still wrong, refused with as-written offered instead.
- **Numbers are respelled for the voice.** Transcribing the voice back
showed it misreads decimals ("3.5" as "three. five"), footnote marks,
and abbreviations; those are fixed before recording.

Limits, stated in the guide: English Kokoro voices only (other Lemonade
speech models are not offered, as GAIA has not proven them); charts are
described from the document's text, not the picture; one dictation
covers about two hours of audio, and a longer document is recorded in
page ranges.

Two notes for the reviewer:

- **No eval was run.** This adds a tool, a skill and a tool bundle,
which is LLM-affecting, but another session's eval was running on this
machine, and evals run one at a time. Categories to watch on the next
RC: `tool_selection`, `gaia_tool_selection`, `web_system` (it holds the
`text_to_speech` scenario) and `rag_quality` (the document tools next to
it). The `dictation` skill is listed as deferred in the skill-scenario
coverage test, because the text lanes cannot judge audio.
- **Not the same as the voice-typing "dictation" in #6789.**
That is speech to text in the composer; this is document to audio. This
PR does not need the generated-media read grant from #6494.

## Screenshots

The audio card after a dictation saved to a folder of the user's, from
the `rtl.visual.ts` scene (English, then Arabic). The path stays left to
right inside the Arabic line.

![Audio card,
English](https://raw.githubusercontent.com/kovtcharov/gaia/f9cf80e5645eaaa25bd0077af96e6b61281b41c4/dictation-card-en.png)

![Audio card,
Arabic](https://raw.githubusercontent.com/kovtcharov/gaia/f9cf80e5645eaaa25bd0077af96e6b61281b41c4/dictation-card-ar.png)

## Test plan

Run against the real apps from an isolated GAIA home, chat model
DeepSeek through Fireworks, voice `kokoro-v1` on Lemonade.

- [x] Agent UI, typed path and a named folder: listening form chosen for
a 2-page report with a table, chart and footnote; player in the chat
(3:27); MP3 and `.script.md` saved in the folder; the reply named the
form and why
- [x] Agent UI, PDF dropped on the composer, "word for word": as-written
MP3 with a player and no permission prompt
- [x] Agent UI, 36-page PDF (20,000 words): refused as too long with a
page range, then recorded in parts; the first part ran 10 minutes as one
tool call and produced 34 min 28 s of audio with progress shown
throughout; Stop during the next part ended the turn and left no partial
file
- [x] TUI: one sentence produced the MP3 and script in the named folder,
progress on the live line, and the audio card with its open and reveal
keys
- [x] Listen-back with Whisper Large v3 Turbo: listening form 95.6% word
match (1 of 62 numbers heard differently, and correct when that sentence
was recorded alone); as-written 90.1% with every number heard; the last
two minutes of the 34-minute file 95.5% against the script's end
- [x] `python -m pytest tests/unit/test_dictation.py
tests/unit/test_lemonade_speech.py
tests/unit/chat/ui/test_generated_media.py
tests/unit/test_chat_tool_requests.py`
- [x] Routing: "Read notes.pdf aloud and save it as report.mp3",
"Narrate chapter1.txt and save as chapter1.wav" and six more variants
offer `dictate_document` first; "Transcribe meeting.mp3", "what does
interview.mp3 say?" and six more that read an existing audio file still
offer `transcribe_media` (`tests/unit/test_chat_tool_requests.py`)
- [x] `python -m pytest tests/unit/test_flagship_tool_labels.py`
(activity label in English and Arabic, live-progress phrase)
- [x] `python -m pytest
hub/agents/gaia/python/tests/test_chat_dictation_tool.py
hub/agents/gaia/python/tests/test_chat_tts_tool.py`
- [x] `cd src/gaia/apps/webui && npm test && npm run test:rtl` (3,449
unit and 456 visual tests pass; a new visual test renders the audio card
with its "Saved to" and "Script saved to" lines in English and Arabic,
and both were read on screen)
- [x] `cd tui && go test ./internal/ui/...`
- [x] `python util/lint.py --tool-descriptions`, black, isort, and
`python util/check_doc_links.py --internal-only`
- [x] Listening rewrite on Gemma 4 E4B (local, GPU): 6 of 7 runs passed
the figure check (one after its retry), 1 was refused for a wrong
figure; a full dictation gave 3 min 33 s of audio in 90 s with 95.1%
listen-back match
- [ ] Not tested: the listening rewrite on Qwen3.6; Linux and macOS; the
packaged desktop app

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-ui Agent UI changes audio Audio (ASR/TTS) changes cli CLI changes daemon Daemon supervisor / sidecar control plane dependencies Dependency updates documentation Documentation changes electron Electron app changes enhancement New feature or request installer Installer changes mcp MCP integration changes talk Talk agent changes tests Test changes tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants