Inspiration
Inspiration
FarmGuard AI was inspired by a simple problem: farmers often have to make important decisions about irrigation, crop health, and farm resources with incomplete or difficult-to-interpret information.
We wanted to build something more useful than a general-purpose agricultural chatbot. A farmer should be able to provide their crop, field size, soil type, moisture, location, and other available context and receive practical guidance without the AI inventing critical numbers.
This led us to design FarmGuard around two principles: context-aware AI and safety-first decision support.
We were especially motivated by the challenge of responsible AI in agriculture. A wrong irrigation calculation or an overconfident crop-health response can have real consequences. So instead of trusting the LLM with everything, we separated deterministic calculations from generative reasoning and added multiple security and validation layers.
The Earth Forward theme also motivated us to focus on sustainable agriculture, water conservation, energy efficiency, and responsible use of AI.
What it does
FarmGuard AI is a secure, context-aware AI decision-support system designed to help farmers make practical decisions about irrigation, crop health, and sustainable farm management.
Farmers often make important decisions using incomplete information—when to irrigate, how much water to use, how long to run a pump, or what to do when crops show symptoms.
FarmGuard combines crop, field area, soil type, soil moisture, location, and weather context to provide clear and practical guidance.
A key feature is deterministic irrigation calculation. Water volume and pump runtime are calculated using verified formulas instead of allowing an LLM to invent numbers. FarmGuard also refuses to estimate pump runtime from horsepower alone when actual discharge information is unavailable.
The system also provides structured crop-symptom triage, sustainability insights, and a security layer designed to protect against prompt injection, secret extraction, unauthorized tool use, and unsafe AI outputs.
How we built it
FarmGuard AI was built with a React + Vite frontend and a Python FastAPI backend.
The AI advisor uses Google Gemini 2.5 Flash for contextual agricultural conversations. Farm context is passed to the agent so responses can consider crop, field size, soil, moisture, location, and weather information.
Critical agricultural calculations are kept separate from the LLM. Irrigation water volume and pump runtime use deterministic formulas, while the AI is responsible for explaining the results in farmer-friendly language.
We also implemented defense-in-depth security with input validation, prompt-injection detection, secret protection, strict tool authorization, output validation, and safe fallbacks.
The system was tested with 114 backend tests and a 107-case adversarial security benchmark covering prompt injection, obfuscation, multilingual attacks, secret extraction, tool abuse, LLM failures, and benign controls.
Pre-existing work included the initial agricultural calculation concepts and FastAPI foundation. During the hackathon, we developed the agentic AI core, security/evaluation system, farmer-focused UI, resilience mechanisms, and submission-ready product experience.
Challenges we ran into
One of our biggest challenges was making an LLM useful without allowing it to invent critical agricultural information.
For irrigation, pump horsepower alone is not enough to calculate runtime because actual discharge in litres per minute is required. We therefore separated deterministic calculations from generative responses and designed the system to ask for missing information instead of guessing.
Another challenge was handling incomplete or ambiguous farmer inputs. The system needs to remain useful while clearly communicating when information is missing.
Security was also a major challenge. We tested the assistant against prompt injection, obfuscated instructions, multilingual attacks, secret extraction attempts, and unauthorized tool-use scenarios.
Finally, we had to make technical AI outputs understandable and actionable for farmers without presenting the system as a replacement for agricultural experts.
Accomplishments that we're proud of
We are proud of building FarmGuard as a complete working AI decision-support product rather than just an LLM chatbot.
Our irrigation system uses deterministic calculations for water volume and pump runtime, including a safety flow for cases where only pump horsepower is provided.
We built a defense-in-depth AI security architecture and evaluated it using a 107-case adversarial benchmark.
The benchmark achieved: • 100% safe handling across all 107 cases • 96.47% malicious-vector detection • 84.71% direct input blocking • 0 secret leaks • 0 unauthorized tool executions • 0% false positives across 22 benign controls • 10/10 simulated LLM failures safely intercepted through output grounding fallbacks
We also completed 114 backend tests and built a responsive React interface designed around practical farmer workflows.
What we learned
We learned that building a reliable AI application requires much more than connecting an LLM to a chatbot interface.
Critical calculations should not depend on an LLM's ability to do arithmetic or infer missing values. Deterministic tools provide a safer foundation, while the LLM can focus on reasoning, explanation, and conversation.
We also learned that AI security needs multiple layers. Prompt-injection detection alone is not enough, so we combined input validation, tool authorization, secret protection, output validation, and fallback mechanisms.
Finally, we learned the importance of evaluation. Building an adversarial benchmark helped us identify failure modes and verify that security controls worked instead of relying only on normal demo conversations.
What's next for FarmGuard AI
Our next steps are focused on improving real-world usefulness and validation.
We plan to expand crop and regional coverage, add more Indian languages, and improve localized agronomic guidance.
Future versions could integrate real farm sensors and IoT devices for soil moisture, pump flow, and field conditions, allowing the system to work with real-time measurements instead of manual inputs.
We also want to improve the sustainability layer with better water and energy impact modeling and validate these estimates using real-world farm data.
Another focus will be continuous AI evaluation and security testing as new agent capabilities and tools are added.
Log in or sign up for Devpost to join the conversation.