DEV Community

Lalit Mohan Oli
Lalit Mohan Oli

Posted on

Building Jan Dhan Seva: A Multi-Agent Voice AI Assistant for Financial Literacy in India ๐Ÿ‡ฎ๐Ÿ‡ณ

Building Jan Dhan Seva: A Multi-Agent Voice AI Assistant for Financial Literacy in India ๐Ÿ‡ฎ๐Ÿ‡ณ

#10DaysOfAIVoiceAgents Challenge โ€” VoiceForBharat Edition by Murf AI

Powered by Murf Falcon TTS, LiveKit Agents SDK, Deepgram STT, Google Gemini LLM, Next.js 15, and SQLite.

Jan Dhan Seva Voice Assistant Banner


๐Ÿ“Œ 1. The Problem & The Audience

In India, hundreds of millions of citizens are entering the formal banking system through national financial inclusion initiatives like the Pradhan Mantri Jan Dhan Yojana (PMJDY). However, a major barrier remains: financial literacy and language accessibility.

Navigating complex banking terminology, understanding government scheme eligibility, calculating fixed deposit (FD) returns, or avoiding cyber fraud can be dauntingโ€”especially for first-time banking users who prefer communicating in their native language over text or voice.

To solve this, I built Jan Dhan Seva (Aarav Voice Agent)โ€”an interactive, register-aware, multilingual AI voice assistant designed to deliver accessible financial guidance in Hindi (Devanagari) and English.
Jan Dhan Seva Homepage & Agent UI


๐Ÿ—๏ธ 2. How the System Works

The system operates on an ultra-low latency (<480ms voice turn) streaming loop using WebRTC transport.

Jan Dhan Seva Architecture Diagram

sequenceDiagram
    autonumber
    actor Caller as ๐Ÿ‘ค Caller (Browser/SIP)
    participant LK as โšก LiveKit WebRTC
    participant STT as ๐ŸŽ™๏ธ Deepgram STT
    participant LLM as ๐Ÿง  Gemini 3.5 LLM
    participant TTS as ๐Ÿ”Š Murf Falcon TTS
    participant DB as ๐Ÿ’พ SQLite & UI Cards

    Caller->>LK: Speaks Audio Chunk
    LK->>STT: Audio Stream
    STT-->>LLM: Real-Time Text Transcript
    LLM->>DB: Execute Tool (e.g. FD Calc / Handoff)
    DB-->>LK: Push Floating UI Card
    LLM->>TTS: Streamed Response Text
    TTS-->>LK: High-Quality Audio Stream (Samar/Pooja/Nikhil/Palak)
    LK-->>Caller: Plays Audio Response (<480ms Latency)
Enter fullscreen mode Exit fullscreen mode

Core Architecture Components:

  1. Streaming Speech-to-Text (STT): Deepgram nova-3 for real-time multilingual speech recognition (Hindi + English).
  2. Brain / Reasoning Engine (LLM): Google gemini-3.5-flash-lite for intent classification, strict language mirroring, and tool calling.
  3. Text-to-Speech (TTS): Murf Falcon โ€” ultra-fast streaming Indian voice models with dynamic voice profile switching (Samar, Pooja, Nikhil, Palak).
  4. Real-Time Transport & State: LiveKit Agents SDK with WebRTC audio streaming, Voice Activity Detection (Silero VAD), and data channels.
  5. Persistence & Telephony: SQLite (data.db) for profile memory, outbound call logs, escalation tickets, and session analytics.

๐ŸŒŸ 3. Most Important Features Built

1. Multi-Agent Mesh Architecture & Dynamic Murf Falcon Voice Handoffs ๐Ÿ”„

Instead of relying on a single monolith agent, Jan Dhan Seva implements a 4-agent specialist mesh featuring:

  • Aarav (Main Guide) โ€” Murf Voice: Samar
  • Kavya (Schemes Specialist) โ€” Murf Voice: Pooja
  • Vikram (Fraud Specialist) โ€” Murf Voice: Nikhil
  • Kirti (FD Calculator Specialist) โ€” Murf Voice: Palak

Multi-Agent Specialist Mesh Network

When a user switches topics, the active agent executes a handoff tool that atomically updates the session's underlying Murf TTS voice profile in real-time without dropping the WebRTC audio connection:

# Code Snippet: Sub-second atomic voice engine transition inside AgentSession
async def _switch_agent(self, specialist: BaseAgent, active_agent_title: str) -> str:
    # 1. Update TTS engine to specialist's assigned Murf voice model
    self.ctx.session._tts = specialist.tts
    # 2. Switch agent persona and instructions
    self.ctx.session.update_agent(specialist)
    # 3. Trigger immediate proactive speech generation
    asyncio.create_task(self.ctx.session.generate_reply())
    return f"Transferred call to {active_agent_title}."
Enter fullscreen mode Exit fullscreen mode

2. Strict Language Mirroring & Financial Guardrails ๐Ÿ›ก๏ธ

Screenshot 1: Language Mirroring & Safety Warning

  • Script Consistency: Hindi input triggers pure Devanagari Hindi output. English input triggers pure English output.
  • Credential Protection: Intercepts requests for PINs, passwords, OTPs, or 16-digit card numbers with immediate security alerts.

3. Persistent Caller Profile Memory & Consent ๐Ÿ’พ

Screenshot 2: Returning User Recognition
Integrates SQLite caller lookup (lookup_caller). Greets returning citizens by name, references their previous interaction date, and enforces explicit user consent before storing personal information.

4. Real-Time Tools & Floating UI Data Cards ๐Ÿ“Š

Screenshot 3: Floating UI Data Cards (Gold/FD/Schemes)

  • Bullion Rate Tool (get_gold_silver_price): Live 24K/22K Gold & Silver market rates via GoldAPI.io.
  • Government Schemes Database (lookup_govt_scheme): Curated eligibility criteria, document checklists, and benefits for major schemes (PMJDY, APY, PMSBY, PMJJBY, Sukanya Samriddhi, PM Kisan, PM Mudra).
  • FD Returns Calculator (calculate_fd_returns): Computes exact quarterly compounding returns based on current SBI rates (7.1% p.a.).

5. AI Guardrails & Non-Decision Boundaries ๐Ÿšง

Screenshot 4: AI Guardrail Boundaries
Implemented strict conversational boundaries preventing the agent from taking binding financial decisions. Scenarios like unauthorized transactions, account freezes, or KYC rejections trigger immediate red linesโ€”redacting PII and generating emergency human escalation tickets.

6. Human Escalation Protocol & Support Portal ๐Ÿšจ

Screenshot 5: Human Escalation & Discord Alerts
Generates unique reference IDs (e.g. ESC-72973) for cyber fraud disputes, redacts PII, saves tickets to SQLite, provides status lookups, and posts rich alerts to Discord support webhooks.

7. Glassmorphic Call Analytics Dashboard ๐Ÿ“ˆ

Call Analytics Dashboard UI

Features 5 live telemetry cards (Total Calls, Success Rate %, Avg Duration, Voice Turn Latency ~480ms), an SVG Donut Chart, failure category breakdowns, and 5-second polling via Next.js 15 REST endpoints (/api/analytics).


๐Ÿ’ก 4. Challenges & How I Overcame Them

Difficulty 1: Handoff Speech Transition Delay

  • Problem: When Aarav transferred a call to Kirti or Vikram, the system initially waited for the user to speak again before the specialist introduced themselves.
  • Solution: Implemented an asynchronous trigger asyncio.create_task(ctx.session.generate_reply()) inside _switch_agent. Now, the moment the TTS engine switches to Murf Palak or Nikhil, the specialist agent proactively greets the caller with zero delay.

Difficulty 2: Function Parameter Binding Mismatches

  • Problem: Tool execution for calculate_fd_returns failed under Gemini because RunContext injection caused signature mismatch errors.
  • Solution: Refactored tool signatures to isolate dynamic arguments and added safe_float type-coercion helpers to handle both string and numeric inputs cleanly.

๐Ÿ› ๏ธ 5. How Readers Can Build and Run It

Follow these steps to get Jan Dhan Seva running locally:

1. Prerequisites

2. Backend Setup

git clone https://github.com/lalit-oli-mohan-479/murf-livekit-starter-my.git
cd murf-livekit-starter-my/backend

# Create .env.local in backend directory (Never commit API keys!)
cp .env.example .env.local

# Install dependencies & run backend dev agent
uv sync
uv run python src/agent.py dev
Enter fullscreen mode Exit fullscreen mode

3. Frontend Setup

cd ../frontend
pnpm install
pnpm dev
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:3000 in your browser, click "START TALKING", and converse with Aarav and his specialist team!


๐Ÿ”ฎ 6. What I Would Improve Next

  • Regional Voice Support: Expanding Murf Falcon voice models to support Tamil, Telugu, Bengali, and Marathi.
  • Offline WhatsApp Receipts: Pushing scheme eligibility checklists and escalation reference IDs via WhatsApp Business API upon call disconnect.

๐Ÿ”— Code & Resources

Built with โค๏ธ for #VoiceForBharat and the #10DaysOfAIVoiceAgents Challenge.

Top comments (0)