How harshkumar133/ai_voice_agent works
RenewSure is a browser-based, knowledge-grounded insurance renewal voice-agent assessment with localized Philippines/Indonesia modes and a human-operator assist dashboard. The main workflow is a customer call: the browser captures audio, obtains an ephemeral provider token, streams to a realtime voice service, and handles its tool calls for market-aware KB answers and mock service actions. The dashboard also detects language, surfaces nudges, and exports call evidence. The README documents these capabilities; sampled source confirms the audio, retrieval, detection, token, and nudge responsibilities. Some UI wiring and export implementation were not sampled, so uncertain internal links are omitted.
Main entry points: app.js Call and dashboard · audio.js Browser audio · retrieval.js Search and citations · gemini-token.js Gemini token route
Components 19
Voice conversation
- Call and dashboard
src/app.js - Browser audio
src/audio.js - Gemini Live
- xAI realtime
- Call scenarios
data/scenarios.json
Knowledge and localization
- Curated KB
data/kb-records.json - Search and citations
src/retrieval.js - Language detection
src/language-market.js
Operator and operations
- Lead and mock actions
src/app.js - Nudges and metrics
src/app.js - Call evidence export
src/app.js
Provider access
- Provider health
api/health.js - Gemini token route
api/gemini-token.js - Gemini token creation
api/_gemini-token-core.mjs - xAI token route
api/xai-token.js - xAI token creation
api/_xai-token-core.mjs
Other components
- Customer
- Google token API
- xAI token API
Connections 22
- Customer → Call and dashboard: starts call
- Call and dashboard → Call scenarios: loads scenarios
- Call and dashboard → Browser audio: starts capture
- Browser audio → Call and dashboard: sends PCM chunks
- Call and dashboard → Gemini token route: requests token
- Call and dashboard → xAI token route: requests fallback token
- Gemini token route → Gemini token creation: creates token
- Gemini token creation → Google token API: requests ephemeral token
- xAI token route → xAI token creation: creates token
- xAI token creation → xAI token API: requests client secret
- Call and dashboard → Gemini Live: streams audio and tools
- Call and dashboard → xAI realtime: streams fallback audio
- Gemini Live → Call and dashboard: returns voice and tool calls
- xAI realtime → Call and dashboard: returns voice and tool calls
- Call and dashboard → Curated KB: loads records
- Call and dashboard → Search and citations: searches and evaluates
- Search and citations → Curated KB: reads records
- Call and dashboard → Language detection: detects customer language
- Call and dashboard → Lead and mock actions: logs mock actions
- Call and dashboard → Nudges and metrics: records nudges and latency
- Call and dashboard → Call evidence export: assembles call evidence
- Call and dashboard → Provider health: checks readiness