Inspiration Over 140 million farming households form the backbone of India's economy and food security. Every year, the Central and State Governments allocate tens of thousands of crores toward agricultural subsidies, micro-irrigation grants, solar pump initiatives (PM-KUSUM), and direct benefit transfers (DBT). Despite these vast resources, a staggering 70% of smallholder farmers never receive their entitled benefits.

The underlying causes are systemic:

Fragmented Welfare Portals: Government schemes are dispersed across dozens of disjointed central, state, and district websites, making discovery an overwhelming task. Dense Statutory Legalese: Government circulars, gazettes, and land mutation laws are written in complex bureaucratic terminology that standard commercial AI models fail to interpret accurately, frequently hallucinating outdated rules. The Literacy and Language Gap: A significant percentage of rural citizens prefer local regional dialects over English or standard formal text. Middlemen Exploitation: Due to lack of direct market access and localized agricultural knowledge networks, farmers frequently sell their harvest at steep discounts to intermediaries. GramSetu AI was conceived to bridge this divide. Our mission is to build a sovereign, autonomous AI operating system designed specifically for rural citizens and smallholder farmers, making government welfare transparent, legal gazettes accessible, and peer-to-peer commerce direct.

What it does GramSetu AI is an integrated, multi-module agricultural operating system comprising four foundational pillars:

  1. Scheme Discovery and Intelligent Evaluation Engine Aggregates hundreds of Central and State Government schemes into a single, unified searchable database. Implements multidimensional filtering across State, Landholding Size, Department, Sector (Solar, Irrigation, Crop Insurance, Credit), and Beneficiary Category. Automatically calculates financial subsidy caps, eligibility criteria, required documentation checklists, and provides one-click direct application links to official government portals.
  2. Niti RAG: Statutory Legal and Gazette AI Advisor An autonomous retrieval-augmented generation engine grounded strictly in verified National and State Government Gazette PDFs. Solves complex agricultural and land inquiries, such as PM-KUSUM Component-B solar pump quotas, PMKSY drip criteria, and RTC land mutation dispute procedures. Generates precise, clickable citations referencing exact gazette document titles, circular numbers, and page numbers. Evaluates and renders financial subsidy tiers and mathematical percentage breakdowns using LaTeX formula notation. Features a floating prompt box with an auto-expanding multi-line textarea, integrated live web gazette search, and 1-tap PDF upload functionality optimized for both desktop and mobile viewports.
  3. Vani: Voice-First Multilingual Indic AI Eliminates literacy and typing barriers by enabling citizens to interact using their native spoken languages, including Kannada, Hindi, Telugu, Tamil, Marathi, and Gujarati. Accurately captures rural speech and accents via advanced Indic Speech-to-Text (STT), routes the statutory inquiry through the Niti RAG engine, and synthesizes the verified answer back in natural, regional Text-to-Speech (TTS).
  4. Kisan Chaupal: Rural Social Network and Direct Crop Marketplace A dedicated rural social community where farmers share field updates, visual story reels, pest-management advice, and organic farming techniques. Incorporates an Instagram-style real-time follow and notification architecture, allowing farmers to follow agricultural peers and receive live alerts. Features an integrated Direct Crop Marketplace where farmers list harvests with high-resolution imagery, quantity, and transparent pricing, connecting directly with institutional and bulk buyers without middlemen deductions. How we built it GramSetu AI is engineered with a modern, production-grade microservices architecture:

Frontend Architecture Framework: Next.js 15 (App Router) with TypeScript, React 19, and Tailwind CSS. State Management & Contexts: Dedicated Auth, Language, and Notification Contexts with local storage hydration and optimistic UI updates. UI Components: Custom-built responsive design system utilizing Lucide React icons, Sonner toast notifications, Markdown parsers with LaTeX math support, and a mobile-first visual viewport adapter preventing virtual keyboard layout distortion. Media Ingestion: Cloudinary integration for direct image, video, and PDF uploads. Backend and Agentic Architecture API Framework: FastAPI (Python 3.11) utilizing asynchronous request handling and Pydantic v2 schemas. Agentic Workflow Orchestrator: LangGraph and LangChain for multi-step agent routing, context classification, query decomposition, and multi-turn conversational memory. LLM Synthesis & High-Throughput Inference: Multi-key rotating pool using Groq Cloud API for ultra-low latency inference, deploying high-performance production models (Llama 3.3 70B Versatile, Llama 3.1 8B Instant). Vector Embeddings & Search: Google Gemini Text Embedding models generating high-dimensional vector representations stored and indexed in MongoDB Atlas Vector Search. Voice Intelligence: Sarvam AI Indic Speech-to-Text and regional Text-to-Speech synthesis engines tailored for Indian languages. Database Layer: MongoDB Atlas for conversational history, gazette vector chunk storage, user profiles, notifications, and social marketplace collections. Challenges we ran into Hallucination Prevention in Legal Gazettes: Standard LLMs often generate inaccurate subsidy percentages or fictional circular numbers. We addressed this by designing a strict LangGraph agentic RAG workflow that forces the model to synthesize answers solely from retrieved vector chunks and live government web sources, requiring explicit document and page citations.

Latency Optimization Across Complex Multi-Step Chains: Initial multi-step RAG pipelines combining embedding generation, vector search, web lookup, and LLM synthesis suffered from latency spikes. We resolved this by implementing an asynchronous key-rotation engine for Groq inference, caching embeddings, and structuring parallel retrieval pipelines, bringing total response times down to under 2 seconds.

Mobile Visual Viewport and Virtual Keyboard Jitter: On mobile devices, opening the on-screen keyboard caused double scrollbars, layout snapping, and intrusive automatic zooming on iOS Safari. We engineered a custom visualViewport listener, locked the parent container with fixed inset-0, enforced a 16px base font size to neutralize iOS auto-zoom, and redesigned the prompt bar into a floating glassmorphic island.

Dynamic Real-Time State Synchronization in Social Feeds: Managing dynamic follow states, unread counters, and story group progressions across disparate components created synchronization mismatches. We implemented centralized handle normalization, unified notification models with computed follow states, and optimistic UI state transitions across the platform.

Built With

Share this project:

Updates

Submission history