Inspiration
Farmers struggle with fragmented data regarding seasonal planning, climate risks, and market fluctuations. The core inspiration was to transform agricultural planning from a reactive process into a proactive one. The goal is to distill massive amounts of environmental and economic data into actionable, critical insights that directly impact a season's success.
What it does
AgriAgent is a proactive agricultural decision-support system. Instead of simply finding grants, it acts as a strategic partner for the upcoming season. When a farmer inputs their region and crop type, the system analyzes localized climate forecasts, disease risks, and market fluctuations to generate a comprehensive, actionable crop strategy months in advance.
How we built it
AgriAgent operates on a Retrieval-Augmented Generation (RAG) architecture powered by Google Vertex AI and MongoDB.
Overnight Data Collection: A "Scout Agent" runs a nightly ETL pipeline to scrape unstructured agricultural and meteorological reports. This text is converted into high-dimensional vectors using Google's text-embedding-004 model and stored in MongoDB Atlas.
Real-Time Interaction: The "Policy Agent" takes the farmer's input and triggers a retrieval process. We configured a Vector Index in MongoDB, allowing the system to use $vectorSearch to perform rapid semantic matching between the user's prompt and our database.
Once the most semantically relevant documents are retrieved, they are injected into Gemini 2.5 Flash. We engineered specific constraints within the prompt so the LLM synthesizes this context into a hyper-personalized, highly technical crop strategy without hallucinating.
Challenges we ran into
Data sourcing at global scale was our most persistent challenge. AgriAgent aggregates data from 15+ external sources across different countries, and each comes with its own limitations. Government wholesale market websites like hal.gov.tr have no official API — we had to build web scrapers with BeautifulSoup and use Gemini to dynamically translate crop names (e.g., "Green Bean" → "FASULYE") for lookup matching. The İzmir Open Data API returns 204 No Content on weekends and holidays, requiring multi-day fallback logic. API Ninjas commodity prices are in USD per bushel while Turkish markets use TRY per kilogram, demanding careful unit normalization. We solved the latency problem by implementing a MongoDB caching layer with a nightly cron job that pre-fetches and stores all prices, reducing response time from ~120 seconds to under 1 second with a single bulk $or query.
Weather and climate data integration presented similar challenges. Open-Meteo provides excellent free data, but correlating 16-day forecasts with 6-month ECMWF SEAS5 seasonal predictions and 10-year historical archives — all with different temporal resolutions and coordinate systems — required building a unified climate service that geocodes farmer locations, fetches from 4 separate Open-Meteo endpoints in parallel, and synthesizes everything into a single trend analysis via Gemini.
Pest and disease intelligence required cross-referencing multiple biodiversity databases. EPPO provides European pest distribution data but uses its own taxonomy codes, while GBIF uses different species identifiers. We built a threat service that queries both, deduplicates results, and uses Gemini to assess regional spread risk — but rate limits and inconsistent response formats from these free scientific APIs made reliability a constant battle.
Satellite data accessibility was another hurdle. Agromonitoring API requires farmers to register field polygons before any NDVI or soil data can be retrieved, and free-tier limits restrict the number of polygons and imagery frequency. We designed graceful degradation so the system still generates meaningful reports even without satellite data.
Accomplishments that we're proud of
True multi-agent orchestration: 7 specialized Gemini-powered agents (Agronomist, Economist, Sustainability, Cooperative, Master, Scout, Policy) that collaborate through a structured pipeline, each with domain-specific expertise and structured JSON output Autonomous database interaction: Our chat agent uses MongoDB MCP Server via Google ADK, allowing Gemini to autonomously query the farmer's data without exposing any technical details to the user Real satellite integration: Live Sentinel-2 NDVI imagery and soil moisture data from Agromonitoring API, giving farmers actual vegetation health maps of their fields On-device offline AI: Flutter Gemma integration enables agricultural advisory even without internet connectivity — critical for rural farmers RAG-powered policy search: The Scout Agent scrapes government websites nightly, embeds policy documents with text-embedding-004, and stores them in MongoDB Atlas Vector Search — enabling semantic retrieval of relevant grants and subsidies MongoDB Change Streams → Push Notifications: When new agricultural policies are detected and inserted into the database, a Change Stream triggers real-time FCM push notifications to affected farmers
What we learned
We learned that agricultural AI is fundamentally a data orchestration problem. The AI models are powerful, but the real challenge lies in collecting, normalizing, and caching data from dozens of heterogeneous sources — government websites with no APIs, regional market databases with inconsistent date formats, and weather services with different coordinate systems.
We also learned the importance of prompt engineering for structured output. Getting Gemini to consistently produce valid JSON matching our Pydantic schemas required iterative refinement of system prompts, especially for the Master Agent that must synthesize outputs from 6 other agents into a coherent strategy report.
Finally, building for multilingual farmers taught us that localization goes far beyond UI translation — TTS pronunciation, crop name translation (e.g., "Green Bean" → "FASULYE" for market API lookups), and culturally appropriate advisory language all matter.
What's next for AgriAgent App
IoT Sensor Integration: We've already built MongoDB Time Series collections and sensor ingestion endpoints — next step is connecting real soil moisture/pH sensors via LoRaWAN for continuous field monitoring
Cooperative Marketplace: Expanding the B2B cooperative agent into a full marketplace where neighboring farmers can coordinate bulk purchasing, shared logistics, and collective bargaining
Predictive Yield Modeling: Training crop-specific yield prediction models on historical harvest data combined with satellite NDVI trends
Expanded Regional Coverage: Adding region-specific agricultural advisories for South Asia, Sub-Saharan Africa, and Latin America where smallholder farmers need this technology most
Built With
- agromonitoring-api
- android
- beautifulsoup4
- css3
- dart
- dio
- fao-food-price-index
- fastapi
- firebase
- fl-chart
- flutter
- flutter-gemma
- flutter-tts
- gemini
- geolocator
- go-router
- google-adk
- google-search-grounding
- html5
- httpx
- image-picker
- ios
- javascript
- mongodb
- mongodb-mcp-server
- open-meteo-forecast
- pydantic
- python-3.12
- riverpod
- vertexai
Log in or sign up for Devpost to join the conversation.