LangGraph agent that answers Kerala panchayat citizen-service questions in spoken Malayalam, only from source-checked official documents, on a 2-core CPU with no paid APIs. Open source; public pilot launched Nov 2026.
Citizens ask local-government (panchayat) offices the same questions again and again: which documents are needed, what the fee is, what the deadline is. Many prefer to ask by voice in Malayalam. English chatbots and paid cloud LLMs do not fit this setting: language coverage, running cost, citizen data leaving the state, and the risk of an LLM inventing fees or rules. The goal was a voice-in, voice-out Malayalam helpdesk that answers only from official sources, says it is unsure instead of guessing, and runs on an ordinary 2-core CPU without paid APIs.
A LangGraph agent served as a FastAPI service in Docker, used as the reply stage of a live Malayalam speech-to-speech assistant. - Routing: a keyword router handles most questions; the LLM classifies only when no rule fires, for speed and predictability. - Retrieval: BM25 over 65 hand-checked entries from official LSGD / K-SMART sources; a script checks every fee and number against its source. BGE-M3 dense search and 130 auto-built charter entries were tested on the held-out set and not adopted (no gain). - Tools: fee calculations run in code, not in the LLM; live weather (Open-Meteo, 68 Kerala towns) and news (RSS) through templates. - Answering: Gemma 4 E2B (4-bit GGUF, llama-cpp-python) answers from one retrieved passage and replies UNSURE when not grounded. - Speech: own fine-tuned Whisper ASR (or IndicConformer) and own VITS Malayalam TTS voice, with in-browser voice activity detection for hands-free use. - Quality: 230 pytest cases incl. a multi-turn conversation harness, GitHub Actions CI on every pull request, LangSmith tracing, and a blind 46-question test set locked by checksum before tuning.
Blind held-out test (46 questions): routing 38/46, service answers 16/24, off-topic declined 6/7, weather 1/5, news 3/5. After fixes (no longer blind): routing 44/46, weather 5/5, news 5/5, service answers 17/24. Wrong fee bands went from 2 in the first end-to-end run to 0 after moving fee logic into code. LLM reply median fell from 75.7 s to 40.2 s on a laptop CPU (RAM prompt cache, one passage per prompt); a full voice turn takes a median 10 s (p90 18.5 s) on a 2-core CPU, 2-6 s on the live Space; warm start 5.2 s vs 8.7 s cold. Live voice check: ASR recognised 14/14 spoken questions. This is a public pilot, so there is no measured citizen impact yet.
AI performance: blind held-out routing accuracy 38/46 (83%) and off-topic refusal 6/7; fee errors reduced from 2 to 0 by moving calculations into code; LLM reply latency cut 47% (75.7 s to 40.2 s median) on CPU; zero paid API cost, with all citizen data processed locally.