A five-node LangGraph advisor for farmers with Hindi and Marathi voice, built in 24 hours at HackWarts (Alta School of Technology, April 2026), top 2 of about 40 teams. Team AlgoRise: Satyam Kumar Singh (the AI service and the frontend wiring), Ved Kumar Singh, Nimit Jain, Parth Kshirsagar (backend, frontend, data).
Live: https://altahackathon.vercel.app (free tiers, cold starts) · case study with the pipeline diagram: https://satyamkumarsingh.com/work/kisanmind
- The pipeline is real: weather → crop → market → financial → insights, a
SharedStatepassed node to node in LangGraph, with rules-first filtering (water, season, soil, budget) before a Gemini rerank, and a rule-based fallback if the model call fails. Voice is Sarvam (Saaras STT, Bulbul TTS) with Groq Whisper and ElevenLabs as fallbacks. - 152 test functions across 9 files, 60 of them for the voice and language layer, written during the hackathon.
- Mandi prices come from CEDA, weather from Open-Meteo; scheme eligibility (PM-KISAN, PMFBY, KCC, PM-Kusum) is rule-matched, not fetched live.
- Not yet measured: recommendation quality. There is no agreement rate against an agronomy reference and no Hindi word-error-rate figure. "150 million smallholder farmers" below is the addressable market, not users.
The original hackathon README follows.
Multi-Agent AI Decision Support System for Indian Smallholder Farmers
🌐 Live Demo · 🤖 Agents · 🛠️ Stack · 🚀 Setup
India's 150+ million smallholder farmers make critical decisions — what to plant, when to sell, which schemes to apply for — without access to real-time data. They rely on middlemen, generational guesswork, and word-of-mouth, resulting in:
| Pain Point | Impact |
|---|---|
| 🏪 Mandi Price Opacity | Farmers sell up to 30% below fair market value |
| 🌱 Poor Crop Selection | Crops planted based on tradition, not soil/climate analysis |
| 🏛️ Missed Govt. Schemes | Thousands of rupees in subsidies unclaimed every season |
| 🌧️ No Weather Intelligence | Irrigation, pest control, and harvest timing are reactive |
KisanMind gives every Indian farmer a personal AI agronomist — combining real-time mandi data, soil intelligence, weather forecasting, and government scheme matching into one unified decision support system.
KisanMind is powered by a 4-agent LangGraph orchestration pipeline. Each agent is a specialised reasoning module that processes a farmer's profile and returns structured, actionable intelligence.
┌────────────────────────────────────┐
│ FARMER PROFILE INPUT │
│ Location · Soil · Land · Budget │
└──────────────┬─────────────────────┘
│
┌──────────────▼──────────────┐
│ 🌤️ Weather Service │
│ IMD Forecast · Geo Lookup │
└──────────────┬──────────────┘
│
┌────────────────────────┬┴───────────────────────┐
│ │ │
┌─────────▼─────────┐ ┌─────────▼─────────┐ ┌─────────▼─────────┐
│ 🌱 Crop Agent │ │ 📈 Market Agent │ │ 🏛️ Finance Agent │
│ Soil × Climate │──▶│ Mandi × MSP │ │ Schemes × Credit │
│ Yield Prediction │ │ Price Trends │ │ Subsidy Matching │
└─────────┬─────────┘ └─────────┬─────────┘ └─────────┬─────────┘
│ │ │
└────────────────────────┼────────────────────────┘
│
┌──────────────▼──────────────┐
│ 💡 Insights Agent │
│ Cross-agent synthesis │
│ Risk summary + Action plan │
└──────────────┬──────────────┘
│
┌──────────────▼──────────────┐
│ 📊 DASHBOARD OUTPUT │
│ Crop · Market · Risk · │
│ Schemes · Field Report │
└─────────────────────────────┘
Recommends the optimal crop based on soil type, climate data, water availability, and historical yield patterns.
| Input | Processing | Output |
|---|---|---|
| Soil type, farm size, district, irrigation | Rule-based elimination → weighted scoring → LLM re-ranking via Gemini 2.0 Flash | Top 3 crops with confidence %, water needs, risk level, profitability, and reasoning chain |
Example: Black Cotton Soil, Wardha, Maharashtra → Wheat (97.8% confidence, Low Risk, Medium Water)
Scans regional mandi prices and forecasts optimal selling windows with MSP comparison.
| Input | Processing | Output |
|---|---|---|
| District, recommended crop | Live APMC mandi data, MSP lookup, price trend analysis | Price per quintal, % change, price trend (rising/falling), selling window, best buyer channel |
Example: Wheat at ₹2,275/q — MSP: ₹2,275 — Trend: Stable → Sell in March via APMC Mandi
Matches the farmer's profile against active government schemes, credit facilities, and subsidies.
| Input | Processing | Output |
|---|---|---|
| Farm profile (land, income, crops, Aadhaar) | Cross-references PM-KISAN, PMFBY, KCC, PM-Kusum eligibility | Budget fit assessment, estimated input cost, credit needs, eligible schemes with action items |
Example: 2-acre farm, ₹1.8L income → PM-KISAN ✅ (₹6,000/yr) + PMFBY ✅ + KCC
Synthesises outputs from all agents into a unified risk summary and actionable plan.
| Input | Processing | Output |
|---|---|---|
| All agent outputs | Cross-agent correlation, contradiction detection, priority ranking | Combined insights, risk summary, numbered action plan, overall confidence score |
KisanMind follows a 3-tier microservice architecture:
┌─────────────────────────────────────────────────────────────────────────┐
│ FRONTEND (Vercel) │
│ Next.js 15 · TypeScript · Zustand │
│ altahackathon.vercel.app │
│ │
│ Landing → Register → OTP → Onboarding → Analysing → Dashboard │
│ ┌──────────┬──────────┬──────────┬──────────┬──────────┬────────────┐ │
│ │ Crop │ Market │ Alerts │ Insights │ Schemes │ Report │ │
│ └──────────┴──────────┴──────────┴──────────┴──────────┴────────────┘ │
│ + Floating Agent Chatbot (Voice + Text) │
└───────────────────────────────┬─────────────────────────────────────────┘
│ REST + Bearer JWT
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ BACKEND (Render) │
│ Node.js · Express 5 · MongoDB · JWT Auth │
│ │
│ /api/auth/* → signup, verify-otp, login (JWT in response body) │
│ /api/farmer/* → GET/PUT profile (protected) │
│ /api/ai/* → proxy to AI service (protected) │
└───────────────────────────────┬─────────────────────────────────────────┘
│ Internal HTTP
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ AI SERVICE (FastAPI / Python) │
│ LangGraph · Gemini 2.0 Flash · Groq Whisper · Sarvam TTS │
│ │
│ /orchestrate → Full 4-agent pipeline │
│ /crop/recommend → Standalone crop analysis │
│ /market/analyze → Standalone market analysis │
│ /financial/analyze → Standalone financial analysis │
│ /chat/follow-up → Conversational Q&A (text) │
│ /chat/voice → Voice input → transcribe → chat → TTS response │
└─────────────────────────────────────────────────────────────────────────┘
Register → Email OTP (Brevo) → Verify → JWT Token → Bearer Auth
│
├── Stored in Zustand (localStorage)
└── Sent as Authorization: Bearer <token>
Cross-domain cookies don't work between Vercel (.vercel.app) and Render (.onrender.com), so the JWT is returned in the response body and stored client-side. The backend's protect middleware accepts both cookie and Bearer header authentication.
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 15 (App Router) | React framework with file-based routing |
| TypeScript | 5 | End-to-end type safety |
| Tailwind CSS | 4 | Utility-first styling with custom design tokens |
| Framer Motion | 12 | Page transitions, agent animations, micro-interactions |
| Recharts | 3 | Bar charts (mandi prices), radial charts (confidence) |
| Zustand | 5 | Persistent global state (auth, profile, AI outputs) |
| Lucide React | — | Consistent icon system across all views |
| Technology | Version | Purpose |
|---|---|---|
| Express | 5 | REST API framework |
| MongoDB | Atlas (Mongoose 9) | Farmer profile storage, auth records |
| JWT | jsonwebtoken | Stateless authentication tokens |
| Bcrypt | bcryptjs 3 | Password hashing (10 salt rounds) |
| Helmet | 8 | Security headers (relaxed for cross-origin) |
| Brevo | @getbrevo/brevo 5 | Transactional OTP emails |
| Cookie Parser | — | Cookie-based auth fallback (localhost) |
| Technology | Version | Purpose |
|---|---|---|
| FastAPI | Latest | Async Python API with auto-docs |
| LangGraph | Latest | Agent orchestration DAG (directed acyclic graph) |
| LangChain | Core ≥ 0.3.52 | LLM abstraction, prompt chains, tool calling |
| Google Gemini | 2.0 Flash | Primary LLM for agent reasoning |
| Groq Whisper | — | Speech-to-text transcription (multilingual) |
| Sarvam AI | — | Text-to-speech synthesis (Hindi, Marathi) |
| langdetect | — | Automatic language detection for voice input |
| httpx | — | Async HTTP client for weather/market APIs |
| Service | Purpose |
|---|---|
| Vercel | Frontend hosting + CDN |
| Render | Backend API hosting |
| MongoDB Atlas | Cloud database |
| GitHub | Source control + CI/CD triggers |
KisanMind/
├── frontend/ # Next.js 15 App Router
│ └── src/
│ ├── app/
│ │ ├── page.tsx # Landing page (marketing)
│ │ ├── register/ # Email + password signup
│ │ ├── otp/ # 6-digit OTP verification
│ │ ├── login/ # Returning user login
│ │ ├── language/ # Language selection (6 languages)
│ │ ├── onboarding/ # 4-step farm data ingestion
│ │ ├── analysing/ # Agent processing animation
│ │ ├── dashboard/ # Command center overview
│ │ ├── crop/ # Crop recommendation deep-dive
│ │ ├── market/ # Mandi price intelligence
│ │ ├── alerts/ # Risk monitoring dashboard
│ │ ├── insights/ # Cross-agent AI synthesis
│ │ ├── schemes/ # Government scheme eligibility
│ │ ├── report/ # Full AI field report
│ │ ├── chat/ # Voice + text chatbot page
│ │ └── profile/ # Farmer profile management
│ ├── components/
│ │ ├── DashboardLayout.tsx # Sidebar + TopBar + MobileNav
│ │ ├── AgentChatbot.tsx # Floating 4-agent Q&A panel
│ │ ├── AuthProvider.tsx # Route protection + session verification
│ │ ├── VoiceRecorder.tsx # Audio capture component
│ │ └── ui/ # Shared UI primitives
│ └── lib/
│ ├── store.ts # Zustand state (auth, profile, AI outputs)
│ ├── backendClient.ts # Typed API client (Bearer auth)
│ ├── aiClient.ts # AI service client (direct)
│ ├── mockData.ts # Fallback data for offline display
│ └── useVoiceChat.ts # Voice recording + processing hook
│
├── backend/ # Node.js + Express 5
│ ├── server.js # App entry point + middleware
│ └── src/
│ ├── config/
│ │ └── db.js # MongoDB Atlas connection
│ ├── controllers/
│ │ ├── auth.controller.js # signup, verify-otp, login
│ │ ├── user.controller.js # GET/PUT farmer profile
│ │ └── ai.controller.js # AI proxy + profile→payload mapper
│ ├── middleware/
│ │ └── auth.js # JWT verification (cookie + Bearer)
│ ├── models/
│ │ └── User.model.js # Mongoose schema (30+ fields)
│ ├── routes/
│ │ ├── auth.routes.js # /api/auth/*
│ │ ├── user.routes.js # /api/farmer/*
│ │ └── ai.routes.js # /api/ai/* (protected)
│ └── services/
│ ├── aiService.js # HTTP client → Python AI service
│ └── emailService.js # Brevo transactional email
│
├── ai/ # Python FastAPI AI Microservice
│ ├── app/
│ │ ├── main.py # FastAPI app + all endpoints
│ │ └── config.py # Settings (env-based)
│ ├── agents/
│ │ ├── crop/ # Crop recommendation agent
│ │ ├── market/ # Market analysis agent
│ │ ├── financial/ # Financial analysis agent
│ │ ├── insights/ # Cross-agent synthesis agent
│ │ └── chat/ # Conversational handler
│ ├── orchestrator/
│ │ ├── graph.py # LangGraph DAG definition
│ │ ├── state.py # SharedState type definitions
│ │ └── nodes/ # Graph node implementations
│ ├── services/
│ │ ├── weather_service.py # IMD weather data fetching
│ │ ├── llm_service.py # LLM provider abstraction
│ │ ├── session_store.py # In-memory conversation sessions
│ │ ├── speech_service.py # Groq Whisper + Sarvam TTS
│ │ └── language_service.py # Language detection
│ ├── tests/ # 8 test suites (pytest)
│ └── requirements.txt
│
└── README.md # This file
🔗 https://altahackathon.vercel.app/
- Register with email → receive OTP → verify
- Onboard — enter farm details (location, soil, land size, crops)
- Analyse — watch the 4-agent pipeline process your data
- Explore — dashboard, crop recommendations, market prices, risk alerts, schemes, full report
- Chat — ask the AI chatbot questions in English or Hindi (voice supported)
git clone https://github.com/Satyam087/AltaHack.git
cd AltaHackcd backend
npm install
# Create .env
cp .env.example .env
# Edit .env with your MongoDB URI, JWT secret, and Brevo API key
npm run dev
# → http://localhost:3000Required .env variables:
PORT=3000
MONGODB_URI=mongodb+srv://...
JWT_SECRET=your_secret_key
NODE_ENV=development
BREVO_API_KEY=your_brevo_key
BREVO_SENDER_EMAIL=your@email.com
BREVO_SENDER_NAME=KisanMind
AI_SERVICE_URL=http://localhost:8000
FRONTEND_URL=http://localhost:3001cd ai
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
# Create .env
cp .env.example .env
# Edit .env with your Gemini API key
python3 app/main.py
# → http://localhost:8000
# → Swagger docs at http://localhost:8000/docsRequired .env variables:
GEMINI_API_KEY=your_gemini_key
LLM_PROVIDER=gemini
AI_SERVICE_PORT=8000cd frontend
npm install
# Create .env.local
echo "NEXT_PUBLIC_BACKEND_URL=http://localhost:3000" > .env.local
npm run dev
# → http://localhost:3001| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/api/auth/signup |
Public | Register with name, phone, email, password |
POST |
/api/auth/verify-otp |
Public | Verify email OTP → returns JWT token |
POST |
/api/auth/login |
Public | Login → returns JWT token + farmer profile |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/api/farmer/profile |
🔒 JWT | Fetch authenticated farmer's full profile |
PUT |
/api/farmer/profile |
🔒 JWT | Update farm details (triggers isProfileComplete) |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/api/ai/health |
Public | Check AI service status |
POST |
/api/ai/orchestrate |
🔒 JWT | Full 4-agent pipeline |
POST |
/api/ai/crop/recommend |
🔒 JWT | Standalone crop recommendation |
POST |
/api/ai/market/analyze |
🔒 JWT | Standalone market analysis |
POST |
/api/ai/financial/analyze |
🔒 JWT | Standalone financial analysis |
POST |
/api/ai/chat |
🔒 JWT | Conversational Q&A |
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Service health + LLM status |
POST |
/orchestrate |
Full LangGraph pipeline |
POST |
/crop/recommend |
Crop agent |
POST |
/market/analyze |
Market agent |
POST |
/financial/analyze |
Finance agent |
POST |
/chat/follow-up |
Text chat with context |
POST |
/chat/voice |
Voice → transcribe → chat → TTS |
cd ai
source venv/bin/activate
pytest tests/ -vTest suites:
test_crop_agent.py— crop recommendation pipelinetest_market_agent.py— market analysis + MSP comparisontest_financial_agent.py— financial analysis + scheme matchingtest_graph.py— full LangGraph orchestrationtest_follow_up.py— conversational chat handlertest_voice_and_lang.py— voice transcription + language detectiontest_weather_service.py— weather data fetchingtest_market_api_e2e.py— end-to-end market API flow
| Feature | Status | Description |
|---|---|---|
| 🌐 Landing Page | ✅ | Marketing page with agent showcase |
| 🔐 Auth (Register/OTP/Login) | ✅ | Email OTP via Brevo, JWT Bearer auth |
| 📋 4-Step Onboarding | ✅ | Location, soil, crops, financial profile |
| 🤖 4-Agent AI Pipeline | ✅ | LangGraph orchestration with Gemini 2.0 |
| 📊 Dashboard | ✅ | Command center with AI-powered insights |
| 🌱 Crop Analysis | ✅ | Top 3 recommendations with reasoning |
| 📈 Market Intelligence | ✅ | Mandi prices, trends, sell signals |
| ✅ | Weather, pest, price, scheme alerts | |
| 💡 AI Insights | ✅ | Cross-agent synthesis + action plan |
| 🏛️ Scheme Eligibility | ✅ | PM-KISAN, PMFBY, KCC, PM-Kusum |
| 📄 Field Report | ✅ | Complete AI analysis summary |
| 💬 Agent Chatbot | ✅ | Context-aware Q&A across all agents |
| 🎙️ Voice Input | ✅ | Groq Whisper (Hindi, Marathi, English) |
| 🔊 Voice Response | ✅ | Sarvam AI TTS |
| 🌐 Multilingual | ✅ | Hindi, Marathi, Punjabi, Telugu, Bengali |
| 📱 Responsive | ✅ | Mobile-first with bottom nav |
| 🚀 Deployment | ✅ | Vercel (FE) + Render (BE) |
| Name | Role |
|---|---|
| Ved Kumar Singh | AI Agent Architecture & LangGraph Pipeline |
| Satyam Kumar Singh | Backend Engineering & Database Design |
| Nimit Jain | Frontend Development & UI/UX |
| Parth Kshirsagar | Full-Stack Integration & Deployment |
Built for AltaHack — a multi-agent AI prototype demonstrating the future of data-driven agriculture in India.
MIT — see LICENSE