DEV Community

Cover image for Building AgriAlert: A Proactive Marathi AI Voice Assistant for Indian Farmers
Parth Deshpande
Parth Deshpande

Posted on

Building AgriAlert: A Proactive Marathi AI Voice Assistant for Indian Farmers

๐ŸŒพ 1. The Mission: Voice AI for the Backbone of Bharat
In rural Maharashtra, timely access to agricultural insights can make or break a harvest. Sudden unseasonal rainfall, fast-spreading crop diseases, and fluctuating Mandi prices directly impact a farmer's livelihood. While modern digital tools exist, digital literacy and complex smartphone UIs often stand in the way.

To bridge this divide, I spent the last 10 days building AgriAlert under the Farm & Field track of the #VoiceForBharat Challenge.

AgriAlert is a Marathi AI voice assistant designed to provide real-time weather advisories, Mandi market rates, crop care guidance, and proactive disaster warnings through voice conversations on the web and direct mobile phone calls.

โš™๏ธ 2. High-Level System Architecture
AgriAlert is built on a real-time conversational voice pipeline:

[ Farmer Voice Input (Web/Phone) ]
โ”‚
โ–ผ
[ STT: LiveKit Multi-Locale Speech-to-Text ]
โ”‚
โ–ผ
[ Brain: LLM with Domain Prompt, Guardrails & Memory ]
โ”œโ”€โ”€ SQLite DB (Caller profile, land size, crops)
โ”œโ”€โ”€ Tools: Mandi Rates & Weather APIs
โ”œโ”€โ”€ Telephony: Outbound SIP Calling
โ””โ”€โ”€ Specialist Agent: Deep Agronomy Handoff
โ”‚
โ–ผ
[ TTS: Murf Falcon (Pooja - Marathi) ]
โ”‚
โ–ผ
[ Real-Time Audio Output (<500ms Latency) ]

๐Ÿš€ 3. Key Features Built Across the 10 Days
Ultra-Fast Regional Voice: Powered by Murf Falcon, the Marathi voice (Pooja) speaks naturally in Devanagari Marathi with near-zero latency, understanding code-mixed terms like "pesticide", "urea", and "weather".

Strict Guardrails: Programmed to never guess market prices without verified sources, and strictly refuses to prescribe toxic chemicals without human expert validation.

Long-Term Caller Memory: Uses an SQLite database to remember returning farmers, their district, and their primary crops upon explicit consent.

Tool Chaining & Live Data: Automatically pulls the caller's saved district to fetch live weather forecasts and Mandi prices without making the farmer repeat themselves.

Proactive Outbound Calls: Uses LiveKit SIP integration to automatically call farmers on their mobile phones when severe weather alerts are issued.

Human Escalation (KVK Integration): Generates traceable support tickets for complex issues, routing them directly to agricultural extension officers.

Call Analytics Dashboard: Tracks success rates, total calls, and call outcomes in real time while enforcing zero PII retention.

Multi-Agent Specialist Handoff: Seamlessly transfers complex disease diagnosis calls to a dedicated Crop Problem Specialist Agent.

๐Ÿ› ๏ธ 4. Key Challenges & How I Solved Them
Devanagari vs. Romanized Script: Early tests occasionally produced Romanized Marathi (e.g., 'namaste' instead of 'เคจเคฎเคธเฅเคคเฅ‡'), which caused TTS pronunciation issues. I resolved this by enforcing strict system prompt constraints requiring all Marathi responses to be strictly in native Devanagari script.

Tool Chaining Latency: Calling multiple tools sequentially added noticeable delays. By pre-fetching caller metadata on session connection and passing cached district data into API calls, latency was kept well under conversational thresholds.

Proactive Call Opt-outs: Outbound calls can easily feel intrusive. I structured the opening script to immediately state who is calling, why (weather warning), and how to opt out within the first two sentences.

๐Ÿ’ป 5. Quickstart Guide: Run Your Own Voice Agent
Prerequisites
Python 3.10+

Murf API Key (with Murf Falcon access)

LiveKit Cloud Project & API Keys

  1. Clone the Starter Code
    Bash
    git clone https://github.com/murf-ai/murf-livekit-starter.git
    cd murf-livekit-starter

  2. Configure Environment Variables
    Create a .env file in the root directory:

Code snippet
LIVEKIT_URL=your_livekit_url
LIVEKIT_API_KEY=your_api_key
LIVEKIT_API_SECRET=your_api_secret
MURF_API_KEY=your_murf_key

  1. Run the Agent Bash python -m venv venv source venv/bin/activate pip install -r requirements.txt python src/agent.py dev

๐Ÿ”ฎ 6. What's Next?
Expanding language models to support multi-lingual pan-India deployment (Hindi, Tamil, Telugu, Gujarati).

Direct integration with official state government agricultural databases and soil testing APIs.

Github Repo: https://github.com/code-with-parth/AgriAlert

Top comments (0)