AgriFlow: Decentralized Multi-Agent Smart Irrigation
Inspiration
Traditional fixed-timer farm irrigation wastes massive amounts of water and inflates electricity costs by watering on rigid schedules regardless of soil tension, weather forecasts, or energy tariffs.
AgriFlow was built to democratize precision agriculture—combining scientific agronomy, multi-agent AI, open weather data, and low-cost hardware ($5–$15 microcontrollers) to eliminate agricultural waste and reduce operational costs without proprietary vendor lock-in.
What It Does
AgriFlow is an autonomous, decentralized multi-agent smart irrigation platform that replaces static watering timers with data-driven precision irrigation. The system cuts water waste by 38% and electricity costs by 45%.
Multi-Agent Decision Architecture
- Sensor Agent: Tracks volumetric soil moisture (VWC%) and matric tension (kPa), while actively monitoring for probe faults.
- Weather Agent: Computes reference evapotranspiration (ET0) and evaluates rain/heatwave probabilities via Open-Meteo.
- Crop Physiology Agent: Calculates exact physiological water demand (ETc = Kc × ET0) across distinct crop growth stages.
- Strategy & Optimization Agent: Dynamically schedules irrigation around energy grid tariffs, water availability, and plant stress limits.
- Actuator Guardrail Agent: Enforces hydraulic safety bounds, checks for pipe leaks, and outputs validated MQTT control commands.
Smart Edge-Case Handling
- Rain Protection: Automatically cancels watering when rain is predicted within 24–48 hours.
- Heatwave Micro-Pulses: Executes short irrigation micro-pulses during extreme heat events to shield crops from acute stress.
- Tariff Optimization: Shifts high-energy pump schedules to off-peak energy windows (saving $4.25+ per cycle).
- Fail-Safe Fallbacks: Smoothly degrades to predictive algorithmic models if physical sensors fail or lose connectivity.
Telemetry Dashboard
Provides real-time weather integration, root-zone moisture depth profiles, sustainability metrics, and multi-region climate support (Toronto, Vancouver, Montreal, Ottawa, Winnipeg).
Technical Stack & Cost Breakdown
| Layer | Technology | Cost | Notes |
|---|---|---|---|
| Frontend | React 18 + Tailwind CSS | Free (OSS) | Responsive dashboard |
| Backend | Express.js + Node.js | Free (OSS) | REST API server with real-time updates |
| Build & Tooling | TypeScript + Vite | Free (OSS) | Type-safe Express middleware & optimized SPA build |
| AI / ML | Google Gemini API | Usage-based ($0.075 / 1M input tokens) | Multi-agent reasoning engine |
| Weather Data | Open-Meteo API | Free (10k req/day free tier) | Real-time weather & evapotranspiration integration |
| Hardware | ESP32 / Arduino + Sensors | $60–$150 / zone | Relay control & soil moisture monitoring (no auth required) |
Key Terms & Mathematical Definitions
| Term / Variable | Full Name | Definition / Agronomic Significance |
|---|---|---|
| ET0 | Reference Evapotranspiration | Total atmospheric water loss via soil evaporation and plant transpiration from a reference surface, calculated via the FAO-56 Penman-Monteith equation (factors in solar radiation, wind, humidity, and temperature). |
| ETc | Crop Evapotranspiration | Exact crop water demand calculated as ETc = Kc × ET0. |
| Kc | Crop Coefficient | Adjusts ET0 baseline based on plant species and specific growth stage. |
| VWC% | Volumetric Water Content | Percentage of total soil volume occupied by liquid water. |
| kPa | Kilopascals (Matric Tension) | Measures how tightly water is bound to soil particles; accurately represents root water extraction effort. |
| MAD | Management Allowed Depletion | The percentage of available soil water that can be depleted before crop stress occurs. |
How We Built It
- Frontend: Built with React 18, TypeScript, and Tailwind CSS. Utilizes D3.js for soil moisture root depth graphs and agent flow diagrams, alongside Framer Motion for smooth UI transitions.
- Backend: Powered by Node.js, Express.js, and TypeScript with Vite middleware.
- AI & Reasoning Engine: Integrates the Google Gemini API (
gemini-3.7-flashvia@google/genai) for multi-agent chain-of-thought deliberation, coupled with a deterministic algorithmic fallback engine for offline reliability. - Data Sources: Open-Meteo API integration to calculate real-time FAO-56 Penman-Monteith evapotranspiration (ET0), temperature, humidity, wind speed, and solar radiation.
- Hardware Interfacing: Designed for ESP32/Arduino microcontrollers ($5–$15) over lightweight MQTT pub-sub protocols using JSON payloads to control capacitive soil sensors and solenoid valves.
Challenges We Ran Into
- Bridging AI with Physical Actuation: Ensuring LLM agent reasoning outputs strict, structured JSON that an IoT relay can safely execute without risky hallucinations or unintended valve overrides.
- Handling Hardware & Network Failures: Building dynamic fallback mechanisms so that API timeouts or faulty soil probes smoothly degrade to algorithmic ET0 predictive models rather than stopping irrigation entirely.
- Balancing Competing Goals: Algorithmically optimizing the trade-off between delaying irrigation for off-peak energy tariffs and preventing crop stress past Management Allowed Depletion (MAD) thresholds.
Accomplishments We're Proud Of
- Proven Sustainability Impact: Demonstrated a 38% reduction in water usage and a 45% decrease in power costs.
- Zero Hardware Lock-In: Created a completely open platform that works with off-the-shelf ESP32/Arduino microcontrollers ($5–$15) and standard solenoid valves.
- Scientific Agronomy Integration: Built real FAO-56 Penman-Monteith evapotranspiration calculations directly into the decision loop instead of relying on crude binary moisture triggers.
- Fail-Safe Guardrails: Implemented an Actuator Guardrail Agent that continuously validates hydraulic safety limits and detects pipe leaks prior to firing relays.
What We Learned
- Soil Dynamics: Combining real-time atmospheric demand (ET0) with soil matric tension (kPa) provides a vastly more reliable measurement of plant stress than volumetric water content (VWC%) alone.
- Economic Lever: Shifting irrigation cycles to off-peak grid energy windows yields substantial financial savings for farmers beyond water conservation alone.
- Safety First: Multi-agent architectures in IoT demand strict, deterministic guardrails to prevent physical edge-case failures in the field.
What's Next for AgriFlow
- Physical Field Deployment: Deploying physical ESP32 nodes across multi-zone farm plots with active MQTT hardware telemetry streaming.
- Bidirectional Webhooks: Adding automated instant SMS/email alerts for pipe leaks, physical valve jams, and sensor offline states.
- Edge AI Execution: Compiling lightweight fallback models to run directly on microcontrollers for full offline field operations during internet drops.
- Expanded Crop & Soil Database: Integrating localized soil dynamics and crop coefficient (Kc) profiles for additional global agricultural zones.
Built With
- arduino
- capacitive-soil-moisture-sensors
- data
- embedded-systems-apis-&-data-processing-open-meteo-api
- environmental
- evapotranspiration-calculation
- express.js
- frontend-&-ui-react-18
- llm-integration-iot-&-hardware-esp32
- microcontrollers
- multi-agent-reasoning-systems
- prompt-engineering
- real-time-updates-ai-&-machine-learning-google-gemini-api
- relay-actuation
- responsive-web-design
- rest-api-design
- spa-development-backend-&-architecture-node.js
- tailwind-css
- typescript
- vite
Log in or sign up for Devpost to join the conversation.