# ppspoornesh/agentic_voice_ai architecture

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

- Interactive diagram: https://gitdiagram.com/ppspoornesh/agentic_voice_ai
- Repository: https://github.com/ppspoornesh/agentic_voice_ai

## Overview

This is a Telugu voice-first assistant that gathers a user's details, checks government-scheme eligibility, explains matches, and simulates an application. The main runtime loop in agent.py orchestrates speech input/output, parsing, memory, planning, scheme retrieval, eligibility checks, and application. SQLite memory and deterministic rules are implemented in the sampled sources. The README also describes an LLM explanation capability; its use by the runtime is not shown in the sampled imports, so that integration is marked optional. The schemes data file is present in the tree but was not sampled.

Main entry points: [`agent.py`](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/agent.py) (Conversation agent), [`voice_io.py`](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/voice_io.py) (Speech input and output), [`memory.py`](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/memory.py) (Conversation memory), [`tools.py`](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/tools.py) (Scheme retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Voice Conversation"]
  node_agent["Conversation agent<br/>[agent.py]"]
  node_voice["Speech input and output<br/>[voice_io.py]"]
end

subgraph group_reasoning["Agent Reasoning"]
  node_planner["Next-action planner<br/>[planner.py]"]
  node_memory_ops["Conversation memory<br/>[memory.py]"]
  node_memory_db[("SQLite memory<br/>[memory.py]")]
  node_number_parser["Telugu number parsing<br/>[telugu_numbers.py]"]
  node_field_parser["Gender and house parsing<br/>[parsers.py]"]
end

subgraph group_schemes["Scheme Services"]
  node_scheme_retrieval["Scheme retrieval<br/>[tools.py]"]
  node_scheme_data["Scheme definitions<br/>[schemes.json]"]
  node_eligibility["Rule-based eligibility<br/>[tools.py]"]
  node_application["Mock application<br/>[tools.py]"]
end

subgraph group_integrations["External Services"]
  node_llm_wrapper["LLM explanations<br/>[llm_wrapper.py]"]
  node_google_stt["Google speech recognition"]
  node_google_tts["Google text-to-speech"]
  node_offline_tts["Offline speech fallback"]
  node_groq["Groq LLM service"]
end

node_user(("Telugu-speaking user"))

node_user -->|"speaks"| node_voice
node_voice -->|"recognizes speech"| node_google_stt
node_agent -->|"captures and speaks"| node_voice
node_agent -->|"requests next action"| node_planner
node_agent -->|"reads and saves"| node_memory_ops
node_memory_ops -->|"reads and writes"| node_memory_db
node_agent -->|"parses numeric replies"| node_number_parser
node_agent -->|"parses categorical replies"| node_field_parser
node_agent -->|"retrieves schemes"| node_scheme_retrieval
node_scheme_retrieval -->|"loads definitions"| node_scheme_data
node_agent -->|"checks eligibility"| node_eligibility
node_eligibility -->|"returns explanation"| node_agent
node_agent -->|"starts mock application"| node_application
node_agent -.->|"requests explanations"| node_llm_wrapper
node_llm_wrapper -->|"calls model"| node_groq
node_voice -->|"tries online speech"| node_google_tts
node_voice -->|"falls back offline"| node_offline_tts
node_voice -->|"plays speech"| node_user

click node_agent "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/agent.py"
click node_voice "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/voice_io.py"
click node_planner "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/planner.py"
click node_memory_ops "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/memory.py"
click node_memory_db "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/memory.py"
click node_number_parser "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/telugu_numbers.py"
click node_field_parser "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/parsers.py"
click node_scheme_retrieval "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/tools.py"
click node_scheme_data "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/schemes.json"
click node_eligibility "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/tools.py"
click node_application "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/tools.py"
click node_llm_wrapper "https://github.com/ppspoornesh/agentic_voice_ai/blob/main/llm_wrapper.py"

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_agent,node_voice,node_user toneBlue
class node_planner,node_memory_ops,node_memory_db,node_number_parser,node_field_parser toneAmber
class node_scheme_retrieval,node_scheme_data,node_eligibility,node_application toneMint
class node_llm_wrapper,node_google_stt,node_google_tts,node_offline_tts,node_groq toneRose
```

## Components

### Voice Conversation

- [Conversation agent](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/agent.py): `agent.py`
- [Speech input and output](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/voice_io.py): `voice_io.py`

### Agent Reasoning

- [Next-action planner](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/planner.py): `planner.py`
- [Conversation memory](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/memory.py): `memory.py`
- [SQLite memory](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/memory.py): `memory.py`
- [Telugu number parsing](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/telugu_numbers.py): `telugu_numbers.py`
- [Gender and house parsing](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/parsers.py): `parsers.py`

### Scheme Services

- [Scheme retrieval](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/tools.py): `tools.py`
- [Scheme definitions](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/schemes.json): `schemes.json`
- [Rule-based eligibility](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/tools.py): `tools.py`
- [Mock application](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/tools.py): `tools.py`

### External Services

- [LLM explanations](https://github.com/ppspoornesh/agentic_voice_ai/blob/main/llm_wrapper.py): `llm_wrapper.py`
- **Google speech recognition**
- **Google text-to-speech**
- **Offline speech fallback**
- **Groq LLM service**

### Other components

- **Telugu-speaking user**

## Connections

- Telugu-speaking user → Speech input and output: speaks (evidence: `voice_io.py`)
- Speech input and output → Google speech recognition: recognizes speech (evidence: `voice_io.py`)
- Conversation agent → Speech input and output: captures and speaks (evidence: `agent.py`)
- Conversation agent → Next-action planner: requests next action (evidence: `agent.py`)
- Conversation agent → Conversation memory: reads and saves (evidence: `agent.py`)
- Conversation memory → SQLite memory: reads and writes (evidence: `memory.py`)
- Conversation agent → Telugu number parsing: parses numeric replies (evidence: `agent.py`)
- Conversation agent → Gender and house parsing: parses categorical replies (evidence: `agent.py`)
- Conversation agent → Scheme retrieval: retrieves schemes (evidence: `agent.py`)
- Scheme retrieval → Scheme definitions: loads definitions (evidence: `tools.py`)
- Conversation agent → Rule-based eligibility: checks eligibility (evidence: `agent.py`)
- Rule-based eligibility → Conversation agent: returns explanation (evidence: `agent.py`)
- Conversation agent → Mock application: starts mock application (evidence: `agent.py`)
- Conversation agent → LLM explanations: requests explanations (evidence: `Readme.md`)
- LLM explanations → Groq LLM service: calls model (evidence: `llm_wrapper.py`)
- Speech input and output → Google text-to-speech: tries online speech (evidence: `voice_io.py`)
- Speech input and output → Offline speech fallback: falls back offline (evidence: `voice_io.py`)
- Speech input and output → Telugu-speaking user: plays speech (evidence: `voice_io.py`)
