# parshxv/voice_agent architecture

> Architecture diagram of the GitHub repository parshxv/voice_agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/parshxv/voice_agent
- Repository: https://github.com/parshxv/voice_agent

## Overview

Veena AI is a bilingual voice insurance agent: a customer speaks or types through the web interface, the backend transcribes microphone audio or accepts text, the conversational RAG agent retrieves policy context and generates a reply, and the voice service speaks it back. The README also describes an agent dashboard and optional Supabase integration, but those frontend modules are not present in the supplied tree. Edges follow shown calls or README-documented behavior; browser-to-server wiring and unsampled features are left unasserted where evidence is absent.

Main entry points: [`app.py`](https://github.com/parshxv/voice_agent/blob/main/app.py) (Web and audio server), [`agentic_rag.py`](https://github.com/parshxv/voice_agent/blob/main/agentic_rag.py) (Conversation agent), [`index_documents.py`](https://github.com/parshxv/voice_agent/blob/main/index_documents.py) (Document indexing), [`voice_service.py`](https://github.com/parshxv/voice_agent/blob/main/voice_service.py) (Speech synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_frontend["Customer interface<br/>[index.html]"]
  node_agent_dashboard["Agent dashboard"]
end

subgraph group_conversation["Conversation runtime"]
  node_server["Web and audio server<br/>[app.py]"]
  node_agent["Conversation agent<br/>[agentic_rag.py]"]
  node_memory["Chat memory<br/>[agentic_rag.py]"]
  node_groq["Groq language model"]
end

subgraph group_knowledge["Knowledge retrieval"]
  node_retriever["Policy retriever<br/>[agentic_rag.py]"]
  node_vector_index[("FAISS index<br/>[faiss_rag.index]")]
  node_indexer["Document indexing<br/>[index_documents.py]"]
  node_policy_docs["Policy documents"]
  node_ollama["Ollama embeddings"]
end

subgraph group_speech["Speech services"]
  node_audio_capture["Audio capture<br/>[app.py]"]
  node_transcription["Speech recognition<br/>[app.py]"]
  node_tts["Speech synthesis<br/>[voice_service.py]"]
  node_speech_provider["Edge TTS"]
  node_audio_player["Audio playback<br/>[voice_service.py]"]
end

node_customer(("Customer"))
node_supabase[("Supabase")]

node_customer -->|"uses"| node_frontend
node_frontend -.->|"sends interaction"| node_server
node_server -->|"records audio"| node_audio_capture
node_audio_capture -->|"transcribes"| node_transcription
node_server -->|"invokes"| node_agent
node_agent -->|"maintains context"| node_memory
node_agent -->|"calls tool"| node_retriever
node_retriever -->|"searches"| node_vector_index
node_indexer -->|"reads"| node_policy_docs
node_indexer -->|"embeds chunks"| node_ollama
node_indexer -->|"writes index"| node_vector_index
node_agent -->|"generates response"| node_groq
node_server -->|"requests speech"| node_tts
node_tts -->|"generates audio"| node_speech_provider
node_tts -->|"plays audio"| node_audio_player
node_agent_dashboard -.->|"optional integration"| node_supabase

click node_frontend "https://github.com/parshxv/voice_agent/blob/main/frontend/index.html"
click node_server "https://github.com/parshxv/voice_agent/blob/main/app.py"
click node_audio_capture "https://github.com/parshxv/voice_agent/blob/main/app.py"
click node_transcription "https://github.com/parshxv/voice_agent/blob/main/app.py"
click node_agent "https://github.com/parshxv/voice_agent/blob/main/agentic_rag.py"
click node_memory "https://github.com/parshxv/voice_agent/blob/main/agentic_rag.py"
click node_retriever "https://github.com/parshxv/voice_agent/blob/main/agentic_rag.py"
click node_vector_index "https://github.com/parshxv/voice_agent/tree/main/faiss_rag.index"
click node_indexer "https://github.com/parshxv/voice_agent/blob/main/index_documents.py"
click node_policy_docs "https://github.com/parshxv/voice_agent/tree/main/rag_docs"
click node_tts "https://github.com/parshxv/voice_agent/blob/main/voice_service.py"
click node_audio_player "https://github.com/parshxv/voice_agent/blob/main/voice_service.py"
click node_agent_dashboard "https://github.com/parshxv/voice_agent/tree/main/frontend"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_agent_dashboard toneBlue
class node_server,node_agent,node_memory,node_groq,node_supabase toneAmber
class node_retriever,node_vector_index,node_indexer,node_policy_docs,node_ollama toneMint
class node_audio_capture,node_transcription,node_tts,node_speech_provider,node_audio_player toneRose
class node_customer toneIndigo
```

## Components

### Web experience

- [Customer interface](https://github.com/parshxv/voice_agent/blob/main/frontend/index.html): `frontend/index.html`
- [Agent dashboard](https://github.com/parshxv/voice_agent/tree/main/frontend): `frontend`

### Conversation runtime

- [Web and audio server](https://github.com/parshxv/voice_agent/blob/main/app.py): `app.py`
- [Conversation agent](https://github.com/parshxv/voice_agent/blob/main/agentic_rag.py): `agentic_rag.py`
- [Chat memory](https://github.com/parshxv/voice_agent/blob/main/agentic_rag.py): `agentic_rag.py`
- **Groq language model**

### Knowledge retrieval

- [Policy retriever](https://github.com/parshxv/voice_agent/blob/main/agentic_rag.py): `agentic_rag.py`
- [FAISS index](https://github.com/parshxv/voice_agent/tree/main/faiss_rag.index): `faiss_rag.index`
- [Document indexing](https://github.com/parshxv/voice_agent/blob/main/index_documents.py): `index_documents.py`
- [Policy documents](https://github.com/parshxv/voice_agent/tree/main/rag_docs): `rag_docs`
- **Ollama embeddings**

### Speech services

- [Audio capture](https://github.com/parshxv/voice_agent/blob/main/app.py): `app.py`
- [Speech recognition](https://github.com/parshxv/voice_agent/blob/main/app.py): `app.py`
- [Speech synthesis](https://github.com/parshxv/voice_agent/blob/main/voice_service.py): `voice_service.py`
- **Edge TTS**
- [Audio playback](https://github.com/parshxv/voice_agent/blob/main/voice_service.py): `voice_service.py`

### Other components

- **Customer**
- **Supabase**

## Connections

- Customer → Customer interface: uses (evidence: `README.md`)
- Customer interface → Web and audio server: sends interaction
- Web and audio server → Audio capture: records audio (evidence: `app.py`)
- Audio capture → Speech recognition: transcribes (evidence: `app.py`)
- Web and audio server → Conversation agent: invokes (evidence: `app.py`)
- Conversation agent → Chat memory: maintains context (evidence: `agentic_rag.py`)
- Conversation agent → Policy retriever: calls tool (evidence: `agentic_rag.py`)
- Policy retriever → FAISS index: searches (evidence: `agentic_rag.py`)
- Document indexing → Policy documents: reads (evidence: `index_documents.py`)
- Document indexing → Ollama embeddings: embeds chunks (evidence: `index_documents.py`)
- Document indexing → FAISS index: writes index (evidence: `index_documents.py`)
- Conversation agent → Groq language model: generates response (evidence: `agentic_rag.py`)
- Web and audio server → Speech synthesis: requests speech (evidence: `app.py`)
- Speech synthesis → Edge TTS: generates audio (evidence: `voice_service.py`)
- Speech synthesis → Audio playback: plays audio (evidence: `voice_service.py`)
- Agent dashboard → Supabase: optional integration (evidence: `README.md`)
