
AIdeas: AgriNexus AI — An AI Agronomist for 100M+ Smallholder Indian Farmers on WhatsApp
A serverless WhatsApp advisor for India's smallholder farmers: voice notes transcribed, crop photos diagnosed, and weather-timed nudges sent — all in Hindi, Marathi, or Telugu, built with AWS Bedrock and Kiro. Built for the AWS Builder 10,000 AIdeas competition -
See AgriNexus AI in action first — full end-to-end demo below
End-to-end demo: Onboarding · Voice · Vision · Behavioral Nudge Loop — built serverless on AWS
My Vision

Why Current Solutions Fail
- Agricultural AI chatbots: Answer questions well. No behavioral follow-up, no closed-loop confirmation, no verified action.
- Generic apps: One-size-fits-all advice ignores local weather, specific crops, and timing windows
- SMS alerts: Text-only, passive, no conversation, no follow-up
- Call centers: IVR (Interactive Voice Response) menus in Hindi that don't serve Marathi or Telugu speakers; limited hours; chronically under-resourced
- YouTube videos: Passive learning, no accountability, no personalization

Why Behavioral Nudges Work
Why This Matters
The Numbers
- 100+ million smallholder farmers in India
- 1:1,000+ extension agent-to-farmer ratio in many districts
- 30-40% annual crop loss to pests and diseases
- $15-20 billion economic impact per year
- 10,000+ farmer suicides annually — debt from crop loss is a leading driver
What Changes for Ramesh
| Scenario | Before AgriNexus | With AgriNexus |
|---|---|---|
| Pest advice | Wait for monthly agronomist visit | Instant RAG response with cited sources |
| Spray timing | Fixed calendar, regardless of weather | Nudge fires when wind < 15 km/h |
| Language | English/Hindi IVR | Native Hindi, Marathi, or Telugu |
| Accountability | None | Closed-loop DONE confirmation |
| Crop loss (projected) | 35% | ~15% |
| Season income | Baseline | +Rs. 30,000 (~$360) |

How AgriNexus Compares to Existing Solutions
| Capability | Farmer.Chat | iSDA Agronomist | AgriChat.AI | AgriNexus AI |
|---|---|---|---|---|
| AI-powered Q&A | Yes | Yes | Yes | Yes |
| WhatsApp delivery | Partial | Yes | Yes | Yes |
| Multi-lingual text | Yes | No | No | Yes |
| Voice input + output | No | No | No | Yes |
| Behavioral nudge engine | No | No | No | Yes |
| Closed-loop DONE confirmation | No | No | No | Yes |
| Weather-triggered proactive alerts | No | Partial | Yes | Yes |
| Verified practice adoption | No | No | No | Yes |
| Cost per farmer at scale | Not public | Not public | Not public | <$0.70/year |
How AgriNexus Works: A Continuous Advisory Cycle
Ramesh onboards in Hindi in under 30 seconds, then gets cited crop advice via Amazon Bedrock RAG
Stage 1: Onboarding & Profiling
1
2
3
4
5
6
7
8
Welcome to AgriNexus AI! 🌾
नमस्ते! AgriNexus AI में आपका स्वागत है।
नमस्कार! AgriNexus AI मध्ये आपले स्वागत आहे.
నమస్కారం! AgriNexus AI కి స్వాగతం.
Please choose your language / कृपया अपनी भाषा चुनें:
[Select Language ▼] → English / हिंदी / मराठी / తెలుగు| Step | AgriNexus asks (Hindi) | Farmer sees |
|---|---|---|
| Language | Multilingual welcome — all 4 languages | English / हिंदी (Hindi) / मराठी (Marathi) / తెలుగు (Telugu) |
| District | बढ़िया! आप किस जिले में हैं? (Great! Which district are you in?) | [लातूर] [जालना] [नागपुर] *(*Latur / Jalna / Nagpur) |
| Crop | धन्यवाद! कौन सी फसल उगाते हैं? (Thank you! Which crop do you grow?) | [कपास] [गेहूं] [सोयाबीन] (Cotton / Wheat / Soybean) |
| Consent | मौसम सलाह चाहते हैं? (Want weather-based advice?) | [हाँ ✅] [नहीं ❌] (Yes / No) |
| Complete | बधाई हो! प्रोफाइल तैयार है। (Congratulations! Profile ready. Ask any question.) | — |
language → location → crop → consent → complete) runs inside the MessageProcessor Lambda, with each state stored in DynamoDB as onboarding_state. No typing required at any step — a farmer who can't read can tap through buttons and be fully onboarded in under two minutes.onboarding_complete: true is written to DynamoDB, Ramesh is profiled: Hindi dialect, Latur district, Cotton crop, nudge consent active. Every subsequent interaction — advice, nudges, reminders — is personalized against that profile.Stage 2: Conversational Advisory

Flow 2: Voice
Voice note in → Amazon Transcribe → Bedrock RAG → Amazon Polly → answer spoken back
Flow 3: Vision / Image Analysis
> विश्वास: 87% | गंभीरता: अधिक (Confidence: 87% | Severity: High)
>
> उपचार: Chlorpyrifos 50% + Cypermethrin 5% EC (Treatment)
> मात्रा: 2ml प्रति लीटर पानी (Dosage: 2ml per litre of water)
> समय: सुबह या शाम को छिड़काव करें (Spray in early morning or evening)
> ⚠️ सुरक्षा: दस्ताने और मास्क पहनें। 48 घंटे बच्चों को दूर रखें।
> (Wear gloves and mask. Keep children away for 48 hours.)
>
> Source: ICAR-CICR Pest Advisory 2024, NIPHM Cotton Advisory 2022
Diseased leaf photo → Claude Vision on Amazon Bedrock → pest diagnosis with dosage and safety warning in under 10 seconds
Flow 4: Nudge Loop (The Behavior-Change Engine)
> (Today is good weather for fungicide spray on wheat. Wind: 8 km/h.)
>
> [हो गया ✓] (Done) [अभी नहीं] (Not now)
Weather check → nudge sent → Not Yet acknowledged → Done detected via DynamoDB Streams → reminders cancelled. Loop closed.
The current MVP focuses on weather-triggered spray nudges. But the same closed-loop architecture applies to any intervention that needs a trigger, a message, and a confirmation: market timing alerts when Mandi (local Market) prices spike, crop stage reminders tied to planting dates, area-wide pest outbreak warnings aggregated from Vision analysis, subsidy application deadlines from government scheme calendars.
- A trigger condition (weather API, price API, crop calendar, aggregated Vision data)
- A message template in the farmer's language
- A confirmation keyword for closed-loop tracking
How I Built This
The Stack
| Layer | Technology |
|---|---|
| Messaging | WhatsApp Business API + API Gateway |
| Intelligence | Amazon Bedrock (Claude 3 Sonnet) + RAG |
| Knowledge Base | Bedrock Knowledge Bases + OpenSearch Serverless |
| Voice In | Amazon Transcribe (hi-IN, mr-IN, te-IN, en-IN) |
| Voice Out | Amazon Polly (Aditi/Kajal neural voices) |
| Vision | Claude 3 Sonnet multimodal |
| Nudge Engine | EventBridge Scheduler + Step Functions + DynamoDB Streams |
| Storage | DynamoDB single-table + S3 |
| Orchestration | AWS SAM, Lambda (Python 3.11) |

Foundation: Onboarding State Machine
language → location → crop → consent → complete) running entirely inside MessageProcessor Lambda. No typing required at any step: language selection uses a WhatsApp list message (supports 4 options — one more than the 3-button reply cap), every subsequent step uses reply buttons rendered in the farmer's chosen script, and the complete profile is written to DynamoDB in under two minutes. Every downstream interaction — RAG responses, nudge targeting, Polly voice selection — is personalised against this profile.
How Each Flow Traverses the Architecture
Flow 1: Text Chat

1
2
3
4
5
6
7
8
9
① Ramesh sends Hindi text via WhatsApp
② API Gateway receives HTTPS POST
③ WebhookHandler Lambda validates HMAC-SHA256 signature, checks DynamoDB idempotency (wamid)
④ Message queued to SQS FIFO (per-phone deduplication)
⑤ MessageProcessor Lambda retrieves farmer profile from DynamoDB
⑥ Bedrock Knowledge Base queried with RAG (FAO + ICAR manuals)
⑦ Retrieved context + farmer profile passed to Claude 3 Sonnet
⑧ Claude generates response in farmer's dialect with source citations
⑨ WhatsApp Business API delivers text reply to RameshFlow 2: Voice

1
2
3
4
5
6
7
8
9
10
① Ramesh sends OGG/OPUS voice note via WhatsApp
② API Gateway → WebhookHandler detects media type, routes to Voice Queue (SQS FIFO)
③ VoiceProcessor Lambda downloads audio from WhatsApp media servers
④ Audio file stored temporarily in S3
⑤ Amazon Transcribe job launched (dialect-matched: hi-IN, mr-IN, te-IN, en-IN)
⑥ Transcribed text returned from Transcribe
⑦ Transcript re-queued to MessageProcessor (same RAG pipeline as text)
⑧ Claude 3 Sonnet generates response
⑨ Amazon Polly converts response to speech (Aditi/Kajal neural voices)
⑩ Ramesh receives both audio reply and text (for reference)Flow 3: Vision / Image Analysis

1
2
3
4
5
6
7
8
① Ramesh photographs a diseased leaf and sends it via WhatsApp
② API Gateway → WebhookHandler detects image media type
③ MessageProcessor Lambda downloads image from WhatsApp media servers
④ Image re-uploaded to S3 with temporary public URL
⑤ S3 URL + agronomic system prompt sent to Claude 3 Sonnet Vision
⑥ Claude identifies pest/disease, confidence level, severity
⑦ Response includes: identification, recommended pesticide, dosage, application timing, safety warning
⑧ Reply delivered to Ramesh; S3 image cleaned upFlow 4: Nudge Loop — Behavioral Engine

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
① EventBridge Scheduler triggers WeatherPoller Lambda daily at 7 AM
② WeatherPoller checks conditions: wind speed, rain forecast, temperature
③ If wind \< 15 km/h and no rain: Step Functions nudge workflow starts
④ Step Functions queries DynamoDB for farmers by region + crop + nudge consent
(also checks: no nudge already sent today — duplicate prevention)
⑤ NudgeSender Lambda sends WhatsApp message with crop-specific nudge + interactive buttons:
"आज गेहूं में फफूंदनाशक स्प्रे के लिए अच्छा मौसम है। हवा 8 km/h। [हो गया] [अभी नहीं]"
(Today is good weather for fungicide spray on wheat. Wind: 8 km/h. [Done ✓] [Not now])
⑥ EventBridge Scheduler records T+24h and T+48h reminder targets
⑦ [If no response] ReminderSender Lambda fires at T+24h with follow-up
⑧ [If no response] ReminderSender fires again at T+48h — final reminder
⑨ Ramesh taps "हो गया" (done)
⑩ DynamoDB Streams triggers ResponseDetector Lambda
⑪ ResponseDetector detects DONE keyword (हो गया / झाला / అయ్యింది / DONE)
(done in Hindi / Marathi / Telugu)
⑫ Pending T+48h schedules deleted from EventBridge; nudge marked COMPLETED in DynamoDBKey Architecture Decisions
Data & Orchestration
PK=USER#\<phone\>, SK=PROFILE|MSG#\<timestamp\>|NUDGE#\<id\>) with GSI (Global Secondary Index) indexes for region-based targeting. The access patterns were defined before the schema was designed — that discipline is the only reason it works cleanly at query time.
AI & Language

Technical Challenges Solved
| Challenge | Solution |
|---|---|
| Duplicate WhatsApp deliveries (race condition) | Conditional DynamoDB put with wamid as idempotency key |
| Long-wait Step Functions at scale | EventBridge Scheduler pattern: short-lived execution + scheduled targets |
| Multi-language prompt inconsistency | Language-specific system prompts + explicit output format instructions |
| Nudge duplicate prevention | Query for existing pending nudges before creating new ones |
| Orphaned reminder schedules after completion | DynamoDB Streams triggers cleanup on DONE detection |
| S3 temporary image access for Vision | Bucket policy + public access block settings in SAM template |
How Kiro and EARS Shaped the Build
- "WHEN a farmer sends a voice note, the system SHALL transcribe it using Amazon Transcribe in the farmer's registered dialect and process it identically to a text message."
- "WHEN wind speed exceeds 15 km/h, the system SHALL NOT send a spray nudge."
- "WHERE the farmer's crop is wheat, the nudge message SHALL reference fungicide, not generic 'spray'."

The Build Journey: Week by Week

Week 2 — Multi-Modal Pipelines
Week 3 — The Nudge Engine
Week 4 — Testing, Hardening, Deployment
Performance & Cost
System Metrics
| Metric | Value |
|---|---|
| API response time | 3-5 seconds (p95, including Bedrock) |
| Lambda cold start | <2 seconds (Python 3.11) |
| RAG accuracy | 95% on golden question test set |
| Vision confidence | 85%+ on pest identification |
| Voice transcription accuracy | 87%+ (Hindi/English) |
| DynamoDB query latency | <10ms |
Cost for 1,000 Active Farmers/Month
| Service | Monthly Cost | Notes |
|---|---|---|
| OpenSearch Serverless (Bedrock Knowledge Base) | ~$174 | Minimum 0.5 OCU × 2 at $0.24/OCU-hr; always-on regardless of query volume |
| Service | Monthly Cost |
|---|---|
| Amazon Bedrock (Claude 3 Sonnet — RAG + Vision) | ~$25 |
| Amazon Transcribe (~500 voice minutes at $0.024/min) | ~$12 |
| Amazon Polly (neural TTS voice replies) | ~$1 |
| Amazon DynamoDB (on-demand) | ~$1 |
| Amazon EventBridge Scheduler | ~$1 |
| API Gateway, SQS, Step Functions, S3, Lambda | ~$0 (free tier / minimal) |
| WhatsApp Business API | ~$0 (first 1,000 conversations/month free) |
| Variable total | ~$40/month |
| Total (fixed + variable) | ~$214/month |

MVP Built Within Competition Budget
| Resource | Amount | Used for |
|---|---|---|
| AWS Credits | $200 | All AWS infrastructure: Lambda, Bedrock, Transcribe, Polly, DynamoDB, SQS, EventBridge, Step Functions, OpenSearch Serverless, API Gateway, S3 |
| Kiro Credits | 2,000 (Pro+ equivalent) | Spec-to-code: EARS requirements → design specs → Lambda stubs → SAM templates |
What I Learned

When I first built AgriNexus, voice was an add-on. Testing changed my thinking. Typing in Devanagari on a basic Android phone is slow and error-prone. Sending a voice note is natural — it's what farmers already do to communicate. Voice needs to be the primary interface, not a bonus feature.
Sending a spray reminder is easy. Knowing whether it worked is hard — and it matters. The T+24h/T+48h reminder chain with interactive DONE/NOT YET buttons came from thinking about what actually changes behavior. An advice bot is useful; a behavior-change loop is transformative.
Early nudges said "spray करने के लिए" (time to spray). Farmers found it vague. When the message said "गेहूं में फफूंदनाशक" (fungicide for wheat) — specific to their crop — engagement increased immediately. Context is credibility.
Initial prompts produced ~60% accuracy. Structured prompts with explicit format instructions and language-specific system messages reached 95%. Treat the AI as a collaborator that needs clear instructions — not a magic oracle.
DynamoDB Streams for DONE detection, EventBridge Scheduler for delayed reminders, SQS for async processing — events scale better than polling loops. Embrace async patterns from day one.
The full stack runs ~$214/month for 1,000 active farmers — 81% of that is fixed OpenSearch Serverless infrastructure that barely moves as you add users. At 10,000 farmers, total cost reaches ~$574/month, or under $0.70/farmer/year. Serverless isn't just a deployment choice here — it's the economic model that makes this viable for NGOs and government programs.
Writing requirements in EARS format before touching code sounds slow. It was actually the fastest path. Clear requirements eliminated rework, prevented gold-plating, and made architecture decisions obvious. The hardest work became business logic — not boilerplate.
What's Next

- Real weather API integration (IMD — India Meteorological Department / Open-Meteo) replacing mock data
- Expanded knowledge base: maize and soybean disease corpus
- Market price queries (mandi prices from public APIs) — conversational first, nudges later
- SMS fallback for farmers without WhatsApp data access
- Amazon Transcribe Streaming migration for <2s voice latency
- Pilot with 2-3 NGOs in Maharashtra and Telangana (target: 500 farmers)
- Expanded nudge triggers: market timing alerts, crop stage reminders, area-wide pest outbreak warnings
- Group broadcast for extension agents (one agent to 50 farmers in a village)
- Seasonal calendar: pre-emptive advice by crop stage and historical patterns
- Analytics dashboard: nudge completion rates by region/crop, pest outbreak detection
- Gamification: streak rewards and priority access for farmers who consistently act on nudges
- Government integration: state agricultural department helpline routing
- IoT: soil moisture sensors triggering irrigation nudges
- Yield tracking: closed-loop from advice to action to outcome
- Expansion to Bangladesh and sub-Saharan Africa (same last-mile problem)
- Goal: 15-20% crop loss reduction across 1 million farmers
Final Thought


Resources
- GitHub: https://github.com/prasadt1/agrinexus-ai
- Knowledge Base Sources: FAO Cotton Production Manual, FAO IPM (Integrated Pest Management) Guide, ICAR-CICR Pest Advisory 2024, NIPHM Cotton Advisory 2022, PAU (Punjab Agricultural University) Package of Practices (Kharif 2024)
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article