<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Saptak Roy</title>
    <description>The latest articles on DEV Community by Saptak Roy (@saptak_roy_950fd751ad80bc).</description>
    <link>https://dev.to/saptak_roy_950fd751ad80bc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4078408%2F19762fa4-d3a5-4b69-b948-333a76373aa0.png</url>
      <title>DEV Community: Saptak Roy</title>
      <link>https://dev.to/saptak_roy_950fd751ad80bc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saptak_roy_950fd751ad80bc"/>
    <language>en</language>
    <item>
      <title>Building Roshni: A Real-Time, Multi-Agent Financial Voice AI for Bharat 🇮🇳</title>
      <dc:creator>Saptak Roy</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:21:08 +0000</pubDate>
      <link>https://dev.to/saptak_roy_950fd751ad80bc/building-roshni-a-real-time-multi-agent-financial-voice-ai-for-bharat-3ao6</link>
      <guid>https://dev.to/saptak_roy_950fd751ad80bc/building-roshni-a-real-time-multi-agent-financial-voice-ai-for-bharat-3ao6</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhmljl4eyzkypsar8cabu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhmljl4eyzkypsar8cabu.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Building Roshni: An Ultra-Low Latency, Multi-Agent Financial Voice Assistant for Bharat 🇮🇳
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;How I built an end-to-end, multilingual financial voice AI using Murf Falcon, LiveKit Agents, Deepgram Nova-3, Google Gemini, and Next.js during the 10 Days of AI Voice Agents Challenge.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🌟 1. The Problem &amp;amp; Why Voice Matters for Bharat
&lt;/h2&gt;

&lt;p&gt;In India, financial inclusion has accelerated rapidly with UPI, digital banking, and government-backed credit initiatives. However, navigating complex interest rates, eligibility criteria for government schemes (like PM Mudra or Sukanya Samriddhi Yojana), and understanding formal banking terms remains intimidating for millions of citizens—especially in regional and tier-2/3 heartlands where digital interfaces can be overwhelming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Text-first interfaces fail where voice thrives.&lt;/strong&gt; &lt;br&gt;
When rural entrepreneurs or first-time bank customers have questions, they don't want to navigate complex web forms or read dense PDFs. They want to ask a direct question in their language and get an immediate, clear, spoken answer.&lt;/p&gt;

&lt;p&gt;To solve this, I built &lt;strong&gt;Roshni AI&lt;/strong&gt; (and her specialist counterpart, &lt;strong&gt;Vikram&lt;/strong&gt;) — an ultra-low latency, conversational financial assistant engineered for natural voice interactions in English, Hindi (Devanagari script), and Hinglish.&lt;/p&gt;


&lt;h2&gt;
  
  
  🏗️ 2. High-Level Architecture &amp;amp; Tech Stack
&lt;/h2&gt;

&lt;p&gt;Building a real-time conversational agent requires synchronizing four core pipelines with sub-second latency:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          [ 👤 User Microphone ]
                    │ (WebRTC Audio Stream)
                    ▼
      ┌─────────────────────────────┐
      │     LiveKit Agents Worker    │
      └──────────────┬──────────────┘
                     │
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;┌───────────────────────┼───────────────────────┐&lt;br&gt;
 ▼                       ▼                       ▼&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
┌─────────────┐       ┌─────────────┐       ┌─────────────────┐
│  Deepgram   │ ────► │Google Gemini│ ────► │   Murf Falcon   │
│   Nova-3    │       │    (LLM)    │       │     Fast TTS    │
│  (Fast STT) │       │             │       │ (Anisha / Samar)│
└─────────────┘       └──────┬──────┘       └────────┬────────┘
│ (Tool / Handoff)      │
▼                       ▼
┌───────────────┐       [ 🔊 Audio Output ]
│ SQLite Memory │
│  &amp;amp; Analytics  │
└───────────────┘

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Stack:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TTS (Text-to-Speech):&lt;/strong&gt; Murf Falcon — Delivering conversational Indian voices (&lt;strong&gt;Anisha&lt;/strong&gt; for general banking and &lt;strong&gt;Samar&lt;/strong&gt; for specialist schemes) with lightning-fast Time-To-First-Byte (TTFB ~95ms).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;STT (Speech-to-Text):&lt;/strong&gt; Deepgram Nova-3 (&lt;code&gt;language="multi"&lt;/code&gt;) for instantaneous multi-language speech recognition.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM Engine:&lt;/strong&gt; Google Gemini (&lt;code&gt;gemini-3.5-flash-lite&lt;/code&gt;) with strict prompt guardrails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-time Transport &amp;amp; Orchestration:&lt;/strong&gt; LiveKit Agents Framework + Silero VAD for natural turn-taking and interruption handling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend Portal &amp;amp; Dashboard:&lt;/strong&gt; Next.js 15, Tailwind CSS, and LiveKit Components React.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Persistence &amp;amp; Call Analytics:&lt;/strong&gt; SQLite with instant synchronous write pipelines.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 3. Key Capabilities Built
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🎙️ 1. Ultra-Realistic Indian Voices via Murf Falcon
&lt;/h3&gt;

&lt;p&gt;Using Murf Falcon’s conversational voices transformed the agent from a robotic IVR into a warm, approachable advisor. By pacing sentences naturally and configuring TTFB optimization, conversational latency stayed under 1 second.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔤 2. Native Devanagari Script Enforcement
&lt;/h3&gt;

&lt;p&gt;A common flaw in bilingual voice bots is sending romanized Hindi (e.g., &lt;em&gt;"namaste, aapka swagat hai"&lt;/em&gt;) to TTS engines, causing English phonetic engines to mispronounce Indian syllables. I enforced strict system prompt constraints:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Always write Hindi in Devanagari script (e.g., "नमस्ते, आपका स्वागत है"). Never write romanized Hindi.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This simple prompt architecture ensured flawless Indian accent pronunciation every single turn.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧠 3. Persistent Memory &amp;amp; User Recognition
&lt;/h3&gt;

&lt;p&gt;Using SQLite (&lt;code&gt;agent_memory.db&lt;/code&gt;), Roshni stores caller identity, preferred languages, and previous queries. Returning users are greeted by name with tailored suggestions based on their recorded financial profile.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛠️ 4. Tool Execution &amp;amp; Dynamic Rate Lookups
&lt;/h3&gt;

&lt;p&gt;Roshni accesses custom tools like &lt;code&gt;check_scheme_rates&lt;/code&gt; to provide live, structured interest rate calculations for Fixed Deposits, Senior Citizen schemes, and Savings accounts without LLM hallucinations.&lt;/p&gt;

&lt;h3&gt;
  
  
  🤝 5. Multi-Agent Specialist Handoff (Day 9 Milestone)
&lt;/h3&gt;

&lt;p&gt;One agent should not try to be an expert in everything. I split responsibilities between two distinct agents:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Roshni (General Banking):&lt;/strong&gt; Powered by Murf Falcon &lt;strong&gt;Anisha&lt;/strong&gt;. Handles general banking and savings queries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vikram (Government Scheme Specialist):&lt;/strong&gt; Powered by Murf Falcon &lt;strong&gt;Samar&lt;/strong&gt;. Specializes in PM Mudra loans, subsidies, and government welfare programs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When a caller asks about government schemes, Roshni announces: &lt;em&gt;"I will connect you to Vikram, our Government Scheme Specialist"&lt;/em&gt;, and hands over the full conversation history to Vikram in real time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Multi-Agent Handoff in LiveKit
&lt;/span&gt;&lt;span class="nd"&gt;@function_tool&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;transfer_to_scheme_specialist&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;RunContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Handoff caller to Vikram for Government Scheme queries.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_state&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;is_success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="nf"&gt;record_call_outcome&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;call_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SUCCESS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Transferred to Scheme Specialist&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;I will connect you to Vikram, our Government Scheme Specialist.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📈 6. Real-Time Call Analytics Dashboard
&lt;/h3&gt;

&lt;p&gt;A dedicated Next.js dashboard tracks live call outcomes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total Calls, Successful Inquiries, and Failure rates.&lt;/li&gt;
&lt;li&gt;Live inspection of active session reference IDs and reasons.&lt;/li&gt;
&lt;li&gt;Zero-cache dynamic API endpoints polling local SQLite metrics every 2 seconds.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💥 4. Engineering Challenges &amp;amp; How I Solved Them
&lt;/h2&gt;

&lt;p&gt;No real-world AI project works on the first try. Here were the biggest hurdles and how I conquered them:&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚡ Challenge 1: The 429 Quota Trap &amp;amp; Model Selection
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; Experimental LLM versions like &lt;code&gt;gemini-3.5-flash&lt;/code&gt; have an ultra-restrictive free tier limit of only 20 requests per day. Voice pipelines consume 10–15 calls per conversation due to streaming transcript evaluations, quickly causing &lt;code&gt;429 Too Many Requests&lt;/code&gt; crashes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Solution:&lt;/strong&gt; I switched to &lt;strong&gt;&lt;code&gt;gemini-3.5-flash-lite&lt;/code&gt;&lt;/strong&gt;, which offers &lt;strong&gt;500 daily requests&lt;/strong&gt;, instantly resolving quota exhaustion and reducing inference latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⏱️ Challenge 2: Synchronous Network Blocking in Function Tools
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; Making synchronous network calls inside tools blocked the Python asyncio event loop, causing LiveKit audio streams to stutter and trigger gateway timeouts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Solution:&lt;/strong&gt; Refactored all tool network operations to use asynchronous non-blocking patterns (&lt;code&gt;aiohttp&lt;/code&gt;), keeping audio streaming perfectly smooth.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  💾 Challenge 3: SQLite Multi-Process Disconnect Race Conditions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; Logging call outcomes strictly on &lt;code&gt;on_disconnected&lt;/code&gt; sometimes missed calls when sessions were terminated abruptly by the browser client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Solution:&lt;/strong&gt; Implemented synchronous write-ahead logging—recording an initial session row immediately on connect and updating it instantly the moment a tool executes.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛠️ 5. Step-by-Step Guide: Run Your Own Voice Agent
&lt;/h2&gt;

&lt;p&gt;Want to run this agent locally? Here is how to get started in under 5 minutes:&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.10+&lt;/li&gt;
&lt;li&gt;Node.js 18+&lt;/li&gt;
&lt;li&gt;Free API Keys: LiveKit Cloud, Murf AI, Deepgram, and Google AI Studio.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 1: Clone the Repository
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone &lt;span class="o"&gt;[&lt;/span&gt;https://github.com/your-username/murf-livekit-starter-main.git]&lt;span class="o"&gt;(&lt;/span&gt;https://github.com/your-username/murf-livekit-starter-main.git&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;murf-livekit-starter-main

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Configure Environment Variables
&lt;/h3&gt;

&lt;p&gt;Create a &lt;code&gt;.env&lt;/code&gt; file in &lt;code&gt;backend/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=your_livekit_api_key
LIVEKIT_API_SECRET=your_livekit_api_secret
DEEPGRAM_API_KEY=your_deepgram_api_key
MURF_API_KEY=your_murf_api_key
GOOGLE_API_KEY=your_gemini_api_key

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Run Backend Agent
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;backend
python &lt;span class="nt"&gt;-m&lt;/span&gt; venv venv
venv&lt;span class="se"&gt;\S&lt;/span&gt;cripts&lt;span class="se"&gt;\a&lt;/span&gt;ctivate
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
python src/agent.py dev

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Run Next.js Frontend
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ../frontend
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;code&gt;http://localhost:3000&lt;/code&gt;, click &lt;strong&gt;Start Session&lt;/strong&gt;, and start talking!&lt;/p&gt;




&lt;h2&gt;
  
  
  🔮 What’s Next?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;More Regional Dialects:&lt;/strong&gt; Adding Tamil, Telugu, and Bengali voice models using Murf Falcon.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Direct Core Banking API Integration:&lt;/strong&gt; Secure sandboxed mock transactions via voice biometric confirmation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low-bandwidth Audio Compression:&lt;/strong&gt; Optimizing codecs for 2G/3G mobile connectivity in rural areas.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔗 Links &amp;amp; Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🎙️ &lt;strong&gt;TTS Engine:&lt;/strong&gt; Murf Falcon API (&lt;a href="https://murf.ai/" rel="noopener noreferrer"&gt;https://murf.ai/&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;⚡ &lt;strong&gt;Realtime Engine:&lt;/strong&gt; LiveKit Voice AI (&lt;a href="https://livekit.io/" rel="noopener noreferrer"&gt;https://livekit.io/&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MY ENTIRE CODE IS IN [ &lt;a href="https://github.com/rumparoy3012-ops/DAY-1-AI-VOICE-AGENT-BUILDING" rel="noopener noreferrer"&gt;https://github.com/rumparoy3012-ops/DAY-1-AI-VOICE-AGENT-BUILDING&lt;/a&gt; ] SO IF VIEW IT FOR BETTER UNDERSTANDING.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Special thanks to the Murf AI team for organizing the #10DaysofAIVoiceAgents — VoiceForBharat Challenge!&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ai</category>
      <category>voiceai</category>
      <category>python</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
