Skip to content

feat(voice): tool calls + canvas orb for voice chat (#581) - #594

Merged
vybe merged 2 commits into
devfrom
feature/581-voice-tool-calls
Apr 29, 2026
Merged

feat(voice): tool calls + canvas orb for voice chat (#581)#594
vybe merged 2 commits into
devfrom
feature/581-voice-tool-calls

Conversation

@vybe

@vybe vybe commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds run_task function declaration to Gemini Live sessions so the voice agent can delegate work to the underlying Claude agent mid-conversation
  • Implements async tool call dispatch (asyncio.create_task, 30s timeout, per-call ID tracking) so tool execution never blocks the audio receive loop
  • Replaces the placeholder VoiceOverlay with a canvas orb driven by value noise + curl noise particle simulation (220 particles, 3 layers, state-based hue rotation)

Changes

Backend:

  • src/backend/services/gemini_voice.py_RUN_TASK_TOOL declaration, _execute_and_respond() coroutine, _execute_tool() via agent_client.task(), _pending_tool_tasks dict
  • src/backend/routers/voice.pyvoice_name param, 3-level system prompt fallback, on_tool_call/on_tool_result callbacks + platform audit logging

Frontend:

  • src/frontend/src/utils/audio.js — AudioWorklet-first mic capture, getAmplitude() via AnalyserNode
  • src/frontend/src/composables/useVoiceSession.jstoolName, amplitude, isToolCalling state; 30ms amplitude polling
  • src/frontend/src/components/chat/VoiceOverlay.vue — pure canvas orb (no CDN), hue rotation per state, amber badge during tool_calling

Tests:

  • tests/unit/test_voice_tools.py — 12 unit tests (tool execution, timeout, callbacks, declaration, task cancellation)

Test Plan

  • Unit tests pass: python3 -m pytest tests/unit/test_voice_tools.py -v (12/12 ✅)
  • Start voice session on an agent and verify canvas orb renders
  • Speak a task that requires agent action — verify orb shows amber badge during execution
  • Verify transcript saves to chat after session ends
  • Verify voice_tool_call audit log entries appear

Fixes #581

🤖 Generated with Claude Code

vybe and others added 2 commits April 29, 2026 18:01
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
vybe force-pushed the feature/581-voice-tool-calls branch from 45e62e7 to 0f0d8f7 Compare April 29, 2026 17:01
@vybe
vybe merged commit 7d8abe8 into dev Apr 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant