May 22, 2026

JanSaathi AI — Autonomous Multilingual Grievance Resolution Agent

ai agentic-ai smart-governance grievance-redressal fastapi citizen-services

सुनवाई SunwAI 🇮🇳

Autonomous Multi-Agent Grievance Resolution System for UP Jansunwai

Developed by Himanshu Yadav | GDG Lucknow APL Hackathon

FastAPI Vanilla JS Gemini Security

सुनवाई SunwAI is a premium, resilient, autonomous multi-agent grievance orchestration and resolution ecosystem specifically optimized for Uttar Pradesh's metropolitan municipalities. Built to solve delayed routing, officer fatigue, and language accessibility, SunwAI auto-classifies vernacular complaints (English, Hindi, Hinglish), routes them to the least-loaded officer with predictive SLAs, and autonomously follows up while keeping citizens updated through real-time native SMS messages.

For highly detailed documentation covering the full Problem Statement, Approach, and Cybersecurity methods, please see the docs/ folder in this repository.


📅 The Evolution of SunwAI

This project was built iteratively to tackle the massive bureaucratic bottlenecks present in India's public complaint portals. We successfully evolved the system from a fast MVP (Version 1) to a highly secure, scalable, and intelligent ecosystem (Version 2).

🛠️ Version 1: The Initial MVP Build

The original version of SunwAI was focused entirely on proving the Multi-Agent Concept.

  • Goal: Demonstrate that AI agents can talk to each other and handle basic public routing.
  • Tech Stack: FastAPI + basic HTML/JS + Gemini 1.5 Flash.
  • Workflow: A user could type a complaint in Hinglish, and a simple linear chain of 4 AI Agents (Intake -> Classify -> Route -> Comm) would process it and output a mocked ticket.
  • Limitations: No security. No database. The APIs were completely open, vulnerable to LLM injection, spammers, and malicious DDOS actors. It was highly susceptible to duplicate ticketing (e.g. 5 neighbors reporting the same pothole).

🛡️ Version 2: The May 31st, 2026 Production & Security Overhaul

Today, the entire system architecture was rewritten and heavily upgraded for production-grade cybersecurity, web stability, and advanced agentic analysis.

  1. Gemini 2.5 Flash Upgrade: Entire backend pipeline migrated from the deprecated gemini-1.5-flash model directly to gemini-2.5-flash, significantly boosting reasoning speed, Hinglish parsing accuracy, and eliminating silent API 404 drops.
  2. Citizen Credibility Index (Section 8): Implemented a robust 0-100 credibility scoring algorithm. The AI analyzes if OTP is verified, word count density, geospatial tagging, distress scoring, and duplication flags to assign a priority status (Low, Medium, High, Verified) to prevent malicious or manufactured urgency attacks.
  3. OTP & JWT Secure Tunneling (Section 4 & 5):
    • Introduced simulated mobile OTP generation and verification barriers on the frontend before allowing grievance submissions.
    • Replaced flat JSON authentication with JWT tokenized sessions.
    • All API keys safely stripped from the frontend and secured purely in main_secure.py.
  4. Prompt Injection & Spam Defense: Introduced PromptSecurityAgent as "Agent 0" to block adversarial LLM injections, and upgraded IntakeAgentV2 with aggressive duplication detection (MD5 hashing) and heuristic spam blockers.
  5. Dynamic Incident Clustering: The new IncidentClusterAgent identifies localized micro-outbreaks (e.g., three people reporting a water leak on the same street) and links them to a single parent ticket.
  6. Frontend Address Geocoding: Enhanced the public form to capture and inject exact string addresses invisibly into the AI's contextual context layer.

🏗️ The V2 Multi-Agent Orchestration Pipeline

      Citizen Grievance Submission (English / Hindi / Hinglish) + OTP Verification
                                   │
                                   ▼
                      ┌───────────────────────────┐
                      │ 0. Prompt Security Agent  │ Blocks malicious injections & threats
                      └────────────┬──────────────┘
                                   │
                                   ▼
                      ┌───────────────────────────┐
                      │ 1. Intake Agent V2        │ Cleans Hindi dialects, strips spam & dupes
                      └────────────┬──────────────┘
                                   │
                                   ▼
                      ┌───────────────────────────┐
                      │ 2. Classification Agent V2│ LLM extracts categories, tags geo-loc
                      └────────────┬──────────────┘
                                   │
                                   ▼
                      ┌───────────────────────────┐
                      │ 3. Sentiment Agent        │ Evaluates distress levels & tone
                      └────────────┬──────────────┘
                                   │
                                   ▼
                      ┌───────────────────────────┐
                      │ 4. Routing Agent          │ Assigns least-loaded in-charge officer
                      └────────────┬──────────────┘
                                   │
                                   ▼
                      ┌───────────────────────────┐
                      │ 5. Incident Cluster Agent │ Groups similar nearby complaints together
                      └────────────┬──────────────┘
                                   │
                                   ▼
                      ┌───────────────────────────┐
                      │ 6. Communication Agent    │ Compiles warm native Hindi SMS alerts
                      └───────────────────────────┘
 

🚀 How to Run locally

🔌 Step 1: Open VS Code Terminal

Ensure your current directory is the root directory of the project: E:\GDG LUCKNOW\Jansathi-AI.

🐍 Step 2: Spin up the Secure FastAPI Backend

Open a terminal and execute:

cd backend
# Make sure to activate your virtual environment if not active:
# ..\venv\Scripts\Activate.ps1

# Install requirements (including newly added PyJWT)
pip install -r requirements_v2.txt

# Boot the new secure server
python -m uvicorn main_secure:app --reload --port 8000
 

The backend server will successfully start listening on http://localhost:8000.

🎨 Step 3: Spin up the Frontend UI

Open a second terminal tab and execute:

cd frontend
python -m http.server 5500
 

The Web App will run instantly on http://localhost:5500/.


🔐 Officer Portal Credentials

To access the administrative Officer Control Dashboard, a secure glassmorphic gate has been implemented:

  • Government Portal Page: Click Officer Panel in the navigation bar.
  • Credentials Check:
    • Test Login: Under the new JWT system, the hardcoded admin is admin / admin123.

👥 Team & Hackathon Attributions

  • Team Name: ATHU
  • Developer: Solo; Himanshu Yadav
  • Hackathon: GDG Lucknow APL Hackathon 🚀
  • Corpus Repository: JanSaathi-AI

This build was uploaded as a hackathon project

Hackathon

Build with AI: Agentic Premier League

View All Projects

1

Give a star to encourage!Discussion
Start a new conversation!
Login to join the discussion
Updates
  • Version 2 — Production & Security Overhaul (31 May 2026) SunwAI was upgraded into a secure, production-ready AI grievance platform. Migrated to Gemini 2.5 Flash for faster reasoning and improved Hindi/Hinglish understanding. Added a Citizen Credibility Index to score complaint authenticity using OTP verification, complaint quality, distress level, and duplicate detection. Implemented JWT authentication, OTP verification, and secure backend-only API key management. Introduced PromptSecurityAgent and advanced spam filtering to block malicious or duplicate submissions. Added Incident Clustering to merge related complaints into a single tracked incident. Enhanced address intelligence for more accurate classification, routing, and prioritization. These upgrades significantly improved security, reliability, scalability, and real-world governance readiness.
    Sunday, May 31st, 2026
  • Version 2 — Production & Security Overhaul (31 May 2026) SunwAI was upgraded into a secure, production-ready AI grievance platform. Migrated to Gemini 2.5 Flash for faster reasoning and improved Hindi/Hinglish understanding. Added a Citizen Credibility Index to score complaint authenticity using OTP verification, complaint quality, distress level, and duplicate detection. Implemented JWT authentication, OTP verification, and secure backend-only API key management. Introduced PromptSecurityAgent and advanced spam filtering to block malicious or duplicate submissions. Added Incident Clustering to merge related complaints into a single tracked incident. Enhanced address intelligence for more accurate classification, routing, and prioritization. These upgrades significantly improved security, reliability, scalability, and real-world governance readiness.
    Sunday, May 31st, 2026
  • Himanshu Yadav
    Friday, May 22nd, 2026