feat(voice): tool calls + canvas orb for voice chat (#581) - #594
Merged
Conversation
Implements VOICE-001 tool calling and the animated speaking orb UI. Backend: - gemini_voice.py: add _RUN_TASK_TOOL declaration, _execute_and_respond() coroutine (asyncio.create_task per call, 30s timeout), _execute_tool() delegates to agent_client.task(), _pending_tool_tasks dict on VoiceSession - voice.py: voice_name param in VoiceStartRequest, 3-level system prompt fallback (DB → container file → auto-generate), on_tool_call/on_tool_result WS callbacks with platform audit logging Frontend: - audio.js: AudioWorklet-first mic capture (blob URL inline), AnalyserNode amplitude extraction via getAmplitude() 0–1 float - useVoiceSession.js: toolName/amplitude state, isToolCalling computed, tool_call/tool_result WS message handlers, 30ms amplitude polling - VoiceOverlay.vue: pure canvas orb — value noise + curl noise particles (220, 3 layers), state hue rotation (listening +90°, speaking +210°), amber badge during tool_calling, no CDN dependencies Tests: - tests/unit/test_voice_tools.py: 12 unit tests covering _execute_tool, _execute_and_respond, tool declaration, end_session task cancellation Fixes #581 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ments Fixes overwritten task handle in connect_and_stream (W1 from PR review) and adds VOICE-007 to requirements.md with correct phase roadmap status (W2). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
vybe
force-pushed
the
feature/581-voice-tool-calls
branch
from
April 29, 2026 17:01
45e62e7 to
0f0d8f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_taskfunction declaration to Gemini Live sessions so the voice agent can delegate work to the underlying Claude agent mid-conversationasyncio.create_task, 30s timeout, per-call ID tracking) so tool execution never blocks the audio receive loopChanges
Backend:
src/backend/services/gemini_voice.py—_RUN_TASK_TOOLdeclaration,_execute_and_respond()coroutine,_execute_tool()viaagent_client.task(),_pending_tool_tasksdictsrc/backend/routers/voice.py—voice_nameparam, 3-level system prompt fallback,on_tool_call/on_tool_resultcallbacks + platform audit loggingFrontend:
src/frontend/src/utils/audio.js— AudioWorklet-first mic capture,getAmplitude()viaAnalyserNodesrc/frontend/src/composables/useVoiceSession.js—toolName,amplitude,isToolCallingstate; 30ms amplitude pollingsrc/frontend/src/components/chat/VoiceOverlay.vue— pure canvas orb (no CDN), hue rotation per state, amber badge during tool_callingTests:
tests/unit/test_voice_tools.py— 12 unit tests (tool execution, timeout, callbacks, declaration, task cancellation)Test Plan
python3 -m pytest tests/unit/test_voice_tools.py -v(12/12 ✅)voice_tool_callaudit log entries appearFixes #581
🤖 Generated with Claude Code