
> KrishiFlow • Zero-Brokerage Direct Agriculture & Zero-Waste Supply Chain
KrishiFlow is an offline-resilient Android app designed to eliminate agricultural waste and middleman exploitation by directly connecting farmers with B2B buyers. Built for the AWS Hackathon, it features AWS Cedar for zero-trust security and Finch for container orchestration. It uses an AI assistant (KrishiMitra AI) supporting Gemini, OpenAI, and Claude with voice commands, alongside an adaptive UI and real-time shelf-life tracking to secure fair pricing in remote areas.
KrishiFlow 🌾🚜
Digital Agricultural Procurement, Direct Supply Flow & Food Loss Reduction Platform
Track 03: Waste & Energy | AWS Hackathon (Build It Track: Open Source, On Your Machine)
🌍 The Problem: Track 03 — Waste & Energy
1. The Waste Crisis (Food Spoilage & Landfill Methane)
- 25%–40% Post-Harvest Loss: In multi-tiered traditional agricultural supply chains (Farm → Village Aggregator → APMC Mandi Auctioneer → Wholesale Trader → Urban Distributor → Retailer), perishable produce (tomatoes, leafy greens, onions, fruits) rots before reaching consumers.
- Methane (CH4) & Landfill Overload: Decaying organic produce in city municipal landfills is a primary driver of municipal greenhouse gases. Methane is over 28 times more potent than carbon dioxide at trapping atmospheric heat over a 100-year timescale.
- Informal Sector Exclusion: Millions of informal pushcart vendors and street fruit/vegetable sellers lack direct access to wholesale surplus pools, paying inflated rates or going understocked while tons of food are discarded daily in mandi dump yards.
2. The Energy & Emissions Crisis (Transit & Cold Storage Burn)
- Redundant Diesel Transport: Produce is hauled back and forth across 3–4 intermediary market yards in heavy diesel trucks before reaching urban centers, burning fossil fuels unnecessarily.
- Cold Storage Energy Waste: Perishables sit in energy-intensive cold rooms waiting for broker speculative pricing instead of immediately flowing to buyers.
💡 The KrishiFlow Solution: Closing the Loop on Waste & Energy
Plain text
[Farmer Harvest] ──────► [KrishiFlow Hub / Direct Route] ──────► [Marts & Street Vendors]│[Surplus-Priority Queue Engine]│(Real-Time Expiry & Flash Markdowns)▼[Zero-Waste Informal Vendor Liquidation]
- Surplus-Priority Queue (Zero Waste Clearance):
- Tracks produce batches by remaining shelf-life hours.
- Automatically triggers 15%–35% flash discounts for batches nearing expiry, routing them immediately to local street pushcart vendors and juice/caterer micro-businesses before rot can begin.
- Quality Grading & Valorization:
- Classifies produce into Grade A (supermarkets/marts), Grade B (street markets/informal vendors), and surplus off-grades for processing, eliminating sorting-station dumping.
- Optimized Direct-Flow Logistics (Energy Conservation):
- Connects harvest clusters directly to city drop points, cutting 2–3 transport hops, reducing freight fuel burn by up to 35%, and eliminating excess cold storage holding time.
- Transparent Fair Economics:
- Farmers earn 15%–18% more by eliminating predatory broker cuts, while buyers receive lower delivered prices.
🏆 How KrishiFlow Qualifies for AWS Hackathon
The "Build It" Track: Open Source, On Your Machine
No AWS account, no credit card, no cloud bill ($0.00 spend).
Category | AWS "Build It" Tool | How KrishiFlow Uses It |
|---|---|---|
Agents and AI | Strands Agents SDK & PartyRock | Multi-agent orchestration for FarmerAdvisorAgent, MandiPriceMatcherAgent, and LogisticsRouteAgent running locally with the user's custom API key. |
Containers & K8s | Finch CLI & EKS Distro | Open-source container runtime (finch-compose.yml) running edge mandi service pods without Docker Desktop licensing. |
Serverless | SAM CLI & LocalStack | Local SAM template (template.yaml) emulating API Gateway, Lambda, and DynamoDB locally on http://localhost:4566 . |
Servers & Runtimes | Firecracker & Corretto 21 | Amazon Corretto 21 OpenJDK and Firecracker microVM lightweight specifications (<120ms boot, 5MB memory). |
Data & Search | OpenSearch | Local OpenSearch node indexing crop batches with fuzzy BM25 and vector similarity search. |
Auth & Policy | Cedar | AWS Cedar policy engine (policies.cedar) enforcing fine-grained RBAC for Farmers, Mitras, Wholesalers, and Drivers. |
The Plumbing | LocalStack EventBridge | In-memory coroutine events and local EventBridge bus with zero cloud spend. |
(For teams with AWS cloud credits, KrishiFlow also ships to AWS Lambda, Amazon API Gateway, Amazon DynamoDB, and Amazon S3 via SAM deploy).
📱 How to Use This App
KrishiFlow provides a role-tailored workflow for the entire agricultural and zero-waste ecosystem:
1. For Farmers (Kisan)
- Pledge Harvest: Tap "Pledge Harvest" or "+" on the Home screen.
- Enter Details: Enter crop name (e.g., Tomatoes, Onions), harvest quantity (kg/quintals), harvest date, and quality grade.
- Price Comparison: Instantly inspect the Direct Flow vs. APMC Mandi comparison card to see the guaranteed net gain (+15% to +18% higher payout).
- AI Farm Advisory: Ask the built-in advisor for weather forecasts, harvest timing, and optimal market pickup windows.
2. For Buyers, Street Vendors & Informal Recyclers (Vyapar)
- Browse Surplus Queue: Navigate to the "Surplus Queue" tab.
- Snag Flash Deals: Discover nearing-expiry lots marked down by 15%–35%. Local street pushcart vendors can claim these immediately to resell at affordable rates to urban neighborhoods.
- Direct Procurement: Post Bulk Purchase Requests (RFQs) for direct farm sourcing with transparent unit economics (Farmer PO, Logistics, Operating Margin clearly broken down).
3. For Saathi Drivers (Logistics)
- Accept Dispatches: View assigned single-hop farm-to-vendor transport orders.
- Direct Routing: Deliver directly to vendor drops without waiting in multi-hour mandi auction yard lines.
- Proof of Delivery: Complete digital drop-off confirmation.
4. For Hackathon Judges & Developers
- Tap the 🏆 Trophy Icon in the top action bar (or choose "AWS Build It Lab" from the navigation drawer).
- Interactive Cedar Policy Sandbox: Select a persona (Farmer, Wholesaler, Mitra, Driver) and test permission evaluations against
policies.cedarin real-time.
- Local SAM & Strands Test: Trigger simulated calls to the local SAM API Gateway and Strands Agent loop.
- Security & Key Management: Open Settings ⚙️ → API Key Management to safely enter or clear custom API keys without hardcoding secrets into the app build.
🚀 Quickstart Commands (Run Locally with Finch & SAM)
Plain text
# 1. Validate AWS SAM templatesam validate -t template.yaml# 2. Start LocalStack and OpenSearch with Finchfinch compose -f finch-compose.yml up -d# 3. Start local SAM API Gatewaysam local start-api --endpoint-url http://localhost:4566 --port 3000# 4. Verify Cedar authorization policiescedar authorize \--policies policies.cedar \--principal 'KrishiRole::"Farmer"' \--action 'KrishiAction::"PledgeHarvest"' \--resource 'KrishiResource::"HarvestBatch"'# => ALLOW
🛠️ Technology Stack
- Client: Kotlin, Jetpack Compose, Material 3, Android Room DB (KSP), Coroutines & StateFlow
- AWS Open Source ("Build It"): AWS Strands Agents SDK, Finch, EKS Distro, SAM CLI, LocalStack, Corretto 21, OpenSearch, Cedar Policy Engine
- AWS Cloud Deploy ("Ship It"): AWS Lambda, Amazon API Gateway, Amazon DynamoDB, Amazon S3, Amazon OpenSearch Service

- Surplus Priority Tab (
SurplusPriorityScreen)
- Use: Perishable waste mitigation and dynamic discounting board.
- Working: Tracks remaining shelf-life hours of harvest batches. When batches near expiration, the system recommends flash discounts (15%–35%) to local street vendors and pushcart operators, calculating food rescued (kg) and greenhouse gas reduction (kg CO2e).

- Hub Operations Tab (
HubOperationsScreen)
- Use: Central command for village micro-aggregation village hubs.
- Working: Displays live inventory stock health, total active tonnage, and incoming RFQs. Operators can review incoming farmer batches, verify quality inspection grades, and aggregate produce into cold-storage ready lots.

- Kisan Farmer Tab (
KisanFarmerAppScreen)
- Use: Dedicated interface for farmers (Kisan) to manage harvests and receive agronomic guidance.
- Working: Farmers input crop name, harvest weight (kg), harvesting date, and asking price. The app compares the price against APMC Mandi benchmark rates and writes the entry to Cloud Firestore and local Room DB simultaneously.

- Gemini AI Assistant & Voice (
KrishiGeminiAssistantDialog)
- Use: Multi-model voice and text conversational assistant (KrishiMitra AI).
- Working: Integrates Speech-to-Text (STT) voice input, Text-to-Speech (TTS) read-aloud in Hindi/English, and action execution tags (e.g.,
[ACTION:OPEN_SHOP]). Allows dynamic switching between Gemini, OpenAI, Claude, and offline ICAR bio-engine.

Produce & Analytics Dashboards, Calculators, & Logs
Produce Dashboard: Detailed audit trail of all inventory lots and spoilage metrics.
Crop Planning Advisor: Soil-specific and seasonal crop recommendations.
Harvest Yield Calculator: Financial estimation tool for expected revenue.
Harvest History Logs: PDF report generator and CSV data exporter (
WasteLogCsvExporter ).User & Farm Profile & Secure Auth: Credential Manager integration for secure sign-in.
Interactive App Tutorial & Guide: Multi-step onboarding walkthrough (
KrishiOnboardingGuideDialog ).how AI was used in KrishiFlow:
1.
Coding & Architecture: AI assisted in designing the MVVM architecture, reactive state flows, Room SQLite persistence, and Jetpack Compose UI components.
2.
Debugging & REST Integration: AI diagnosed compile errors, fixed OkHttp timeouts, resolved Gemini REST JSON payload requirements ("role": "user"), and set up multi-model API fallbacks.
3.
In-App Product Feature (KrishiMitra AI): AI powers the core multi-model Bring-Your-Own-Key (BYOK) inference engine (Google Gemini, OpenAI, Claude, and Offline ICAR Bio-Engine) with voice control and app navigation commands.
4.
Documentation & Hackathon Submission: AI generated comprehensive technical reports, AWS hackathon submission forms, demo video scripts, and developer release notes.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article