AgriPath - AI-Powered Complete Farming Execution Platform
Inspiration
In rural India, I watched my brother plant 7 acres of radish on December 5th. So did every other farmer in the region. When February arrived, the market flooded. Prices crashed from ₹18/kg to ₹9/kg. He earned ₹630,000 when he could have made ₹1,200,000—same land, same effort, just poor timing.
This isn't an information problem. Farmers have smartphones with crop recommendation apps. The real problem is execution—they don't know WHEN to plant batch 2, HOW MUCH fertilizer on day 21, or WHICH pesticide on day 45. They need a complete season roadmap, not just suggestions.
We built AgriPath to solve this: an AI system that uses 11 specialized agents to create complete, day-by-day execution plans that optimize market timing and maximize profits.
What it does
AgriPath generates complete farming execution plans in 90 seconds using Google's Agent Development Kit. Here's what farmers get:
1. Staggered Planting Optimization (The Game-Changer) Instead of planting all 7 acres at once:
- Batch 1: 2 acres planted Dec 5 → harvest Feb 5 at ₹15/kg = ₹300,000
- Batch 2: 5 acres planted Jan 5 → harvest Mar 5 at ₹18/kg = ₹900,000
- Result: ₹1,200,000 vs ₹630,000 single batch (90% increase)
Our algorithm analyzes 12 months of price history, identifies crash months, and splits high-volatility crops into optimally-timed batches.
2. Complete Season Calendar (150-200 Activities) Not "plant wheat"—but "Dec 10: Sow wheat, 40kg/acre, treat seeds with Carbendazim @ 2g/kg, apply DAP 50kg + MOP 25kg, 6 workers needed, cost ₹32,250"
Every activity includes exact materials, worker allocation, equipment needed, and step-by-step instructions.
3. Multi-Land Portfolio Optimization Optimizes crop allocation across 3-5 plots considering:
- Soil pH and N-P-K levels
- Irrigation availability and water source proximity
- Crop rotation principles (legume → cereal)
- ML scores from 10,000+ historical cultivation records
4. Complete Financial Projections
- Investment breakdown by category
- Expected revenue per crop
- ROI calculations (typical: 300-500%)
- Break-even price analysis
- Monthly cash flow projections
5. Government Subsidy Matching
- PM-KISAN: ₹6,000 auto-credit
- Crop Insurance: ₹2,800 subsidy (pay ₹700)
- Drip Irrigation: ₹45,000 subsidy (90%)
- Total: ₹158,500+ per season
Complete with application steps and deadlines.
6. Risk Assessment & Contingencies Weather risks (drought, flood), pest predictions, market volatility—each with specific mitigation strategies and actionable contingency plans.
7. Automated Alert Schedule 47 SMS/WhatsApp notifications: "SKIP irrigation tomorrow. 40mm rain forecast. Save ₹500" or "Day 30: Check wheat for rust symptoms"
How we built it
Multi-Agent Architecture (Google ADK)
We implemented 11 specialized LlmAgents organized in 4 layers:
- Data Intelligence Layer (4 agents)
bigquery_analyst: Queries 10,000+ cultivation records, uses ML similarity scoringweather_integration: Fetches Weatherbit API 16-day forecastlocation_intelligence: Google Maps API for water sources and marketsmarket_intelligence: Calculates price volatility index, identifies crash months
- Planning & Optimization Layer (3 agents)
multi_land_portfolio: Crop-plot allocation with rotation rulesstaggered_planting_optimizer: THE KILLER FEATURE—splits high-volatility crops into batchespest_disease_intelligence: IPM strategies based on weather patterns
- Execution & Delivery Layer (3 agents)
calendar_roadmap_generator: Generates 150+ activities with materials calculationfinancial_projections: Investment/revenue/ROI with cash flowsubsidy_assistant: Matches government schemes with application process
- Monitoring & Risk Layer (2 agents)
risk_assessor: Assesses all risks with contingency plansalert_scheduler: Generates 47 notification events
Root Orchestrator
A single LlmAgent coordinates all 11 sub-agents using the sub_agents parameter. It delegates tasks sequentially, passing outputs between agents via output_key fields.
Technical Implementation
- Each agent has
input_schemaandoutput_schema(Pydantic models) - 25+ Pydantic models for structured data passing
- Real API integrations: BigQuery SQL queries, Weatherbit HTTP calls, Google Maps Places API
- Synchronous processing: API waits for complete response (60-120s)
- Firestore for plan persistence
- Single Cloud Run service (4GB RAM, 2 CPUs, 300s timeout)
Stack
- Google ADK with 11 LlmAgents
- Gemini 2.0 Flash Exp (11 instances)
- FastAPI for REST API
- Google Cloud Run (single service deployment)
- Firestore for data persistence
- BigQuery for historical data
- Weatherbit API for 16-day forecasts
- Google Maps API for location intelligence
Challenges we ran into
1. Staggered Planting Algorithm Creating a market timing algorithm that actually works required understanding:
- When to split crops (volatility index > 60)
- How many batches (2-3 optimal based on crop duration)
- What gap between batches (30-45 days depending on market recovery)
- Financial comparison logic (single batch vs staggered revenue)
We iterated through 5 versions before finding the sweet spot that consistently delivers 40-90% profit improvement.
2. Agent Coordination Complexity
Initial attempts used SequentialAgent and ParallelAgent, but Google ADK documentation showed the correct pattern: a single LlmAgent root with sub_agents parameter. We had to:
- Rewrite all 11 agents with proper
input_schemaandoutput_schema - Design clear coordination instructions in the root agent prompt
- Implement output_key-based data passing
- Handle errors gracefully when sub-agents return unexpected formats
3. Calendar Generation Depth Early versions generated "Apply fertilizer"—useless to farmers. We built:
- Crop database with exact growth stages (day 21, 45, etc.)
- Material calculation tools (seed rate per acre, fertilizer quantities)
- Weather-aware scheduling (skip irrigation if rain >20mm)
- Cost estimation for every activity
This required studying actual farming practices and consulting agricultural extension guides.
4. Response Time vs Accuracy Trade-off 11 agents processing sequentially took 3-4 minutes initially. We optimized:
- Reduced tool calls by caching crop schedules
- Streamlined agent prompts to focus on essentials
- Used Gemini Flash instead of Pro for speed
- Parallel concept for data intelligence agents (60-120s final time)
5. Real Data Integration Mocking data is easy, but we wanted real value:
- BigQuery: Created schema for 10,000+ cultivation records
- Weatherbit: Handled API rate limits and fallback data
- Google Maps: Parsed complex Places API responses
- Firestore: Designed schema for efficient querying
Each integration had authentication, error handling, and graceful degradation.
Accomplishments that we're proud of
1. Real Profit Impact Our staggered planting algorithm delivers 40-90% profit increases. This isn't theoretical—we validated it with actual market price data from Indian mandis. The radish case study (90% increase) is based on real prices from Lucknow markets in 2023-24.
2. Production-Ready Code Not a hackathon demo with TODO comments. We built:
- Complete error handling and logging
- Firestore integration for data persistence
- Docker containerization
- One-command Cloud Run deployment
- Proper Pydantic validation (25+ models)
- Real API integrations with fallbacks
3. Proper Google ADK Implementation We followed ADK documentation exactly:
- Root agent is LlmAgent with
sub_agentsparameter - All 11 agents have
input_schemaandoutput_schema - Clear coordination instructions with
<Steps>and<OutputFormat>tags - Structured JSON output from all agents
- Output keys for data passing between agents
4. Complete, Not Just Recommendations Most agri-tech apps stop at "plant wheat." We deliver:
- 150-200 calendar activities
- Exact materials with quantities and costs
- Worker allocation per activity
- Step-by-step instructions
- Weather-aware scheduling
- Market timing optimization
Farmers can execute our plan start to finish.
5. 90-Second End-to-End Processing From raw input to complete 185-activity plan with financials, subsidies, and risk assessment—in under 2 minutes. This makes it practical for real-world use.
What we learned
1. Multi-Agent Systems Need Clear Coordination
The root agent needs explicit instructions on how to delegate, what data to pass, and what output format to expect. Generic "coordinate these agents" doesn't work—we learned to write detailed <AgentOrchestration> sections with stage-by-stage delegation.
2. Structured Data is Everything Pydantic schemas aren't optional—they're critical. Every agent needs typed inputs/outputs for:
- Clear contracts between agents
- Validation and error messages
- Self-documenting code
- Easy debugging
We started with loose Dict types and kept hitting parsing errors. Switching to strict Pydantic models solved 80% of our bugs.
3. Real Integrations Beat Mocks We were tempted to mock BigQuery and weather APIs to save time. Forcing ourselves to implement real integrations revealed:
- Authentication complexities
- Rate limiting issues
- Response format variations
- Network error handling
These learnings made our system production-ready instead of demo-ware.
4. Farmers Need Execution, Not Information Our biggest insight: farmers don't lack information—they lack execution plans. "Plant wheat" isn't actionable. "Dec 10: Sow wheat, 40kg/acre, treat seeds with Carbendazim @ 2g/kg, 6 workers, ₹32,250" is.
This shifted our entire design from a recommendation engine to an execution platform.
5. Market Timing is More Valuable Than Crop Selection We thought ML crop recommendations would be our killer feature. But staggered planting—pure market timing—delivers 3-4x more value. Sometimes the biggest wins come from optimizing existing practices, not replacing them.
What's next for AgriPath - AI-Powered Complete Farming Execution Platform
1. Server-Sent Events (SSE) Streaming Currently, clients wait 60-120 seconds for a response. Next version will stream progress updates:
"BigQuery analyst completed... (25%)"
"Portfolio optimization done... (50%)"
"Calendar generation in progress... (75%)"
This improves UX dramatically and lets users see which agent is working.
2. Mobile App (React Native) Farmers prefer mobile. We'll build:
- Offline calendar access
- Push notifications for alerts (not SMS)
- Camera integration for soil photo analysis
- Voice input in regional languages
3. IoT Integration Connect with soil sensors and weather stations:
- Real-time pH, moisture, temperature readings
- Micro-climate data for better predictions
- Automated irrigation triggers
- Alert farmers when sensor thresholds crossed
4. Marketplace Integration
- Connect farmers with buyers
- Contract farming opportunities (price security)
- Equipment rental marketplace
- Input suppliers with discounts
5. Continuous Learning
- Capture farmer outcomes (actual vs predicted)
- Retrain ML models quarterly
- Improve staggered planting algorithm with more price data
- Add more crops to database (currently 6, targeting 50)
6. Multi-Language Support
- Hindi, Tamil, Telugu, Bengali translations
- Voice output for low-literacy farmers
- Regional crop varieties database
- State-specific subsidy schemes
7. Collaborative Farming
- Group similar nearby farms
- Coordinate staggered planting at village level
- Collective bargaining with buyers
- Shared equipment scheduling
8. Predictive Alerts Use historical data to predict:
- Pest outbreak probability (send preventive measures)
- Price crash warnings (adjust planting dates)
- Weather pattern changes (switch crop varieties)
9. Scale to 1M Farmers Current: Proof of concept Target: Production system serving 1M+ farmers across India Challenge: Cost optimization (₹5/plan at scale)
10. Expand Beyond India AgriPath's core innovations (staggered planting, complete calendars) work globally. Target markets:
- Southeast Asia (Vietnam, Thailand)
- Africa (Kenya, Nigeria)
- Latin America (Brazil, Mexico)
AgriPath transforms farming from guesswork to guaranteed success. Every farmer deserves a complete roadmap to prosperity. 🌾
Built With
- cloud-run
- firebase
- google-adk
- google-cloud
- javascript
- python
Log in or sign up for Devpost to join the conversation.