Farm-AI is a cutting-edge, multi-agent artificial intelligence system designed to assist farmers with daily agricultural tasks. It leverages modern LLMs (Language Models) and RAG (Retrieval-Augmented Generation) to provide personalized advice, market intelligence, weather forecasts, and plant disease diagnosis.
The system is built on a modular LangGraph architecture, orchestrating specialized agents that share a unified memory of the farmer's profile, crops, and past activities.
The system uses a Supervisor-Worker pattern with a Decoupled React + FastAPI architecture.
graph TD
User((User)) -->|Browser| Frontend[React Frontend]
User -->|SMS| Twilio[Twilio Gateway]
Frontend -->|REST API| Backend[FastAPI Backend]
Twilio -->|Webhook| Backend
subgraph "FastAPI Backend"
Backend -->|State| Supervisor{Supervisor Agent}
subgraph "Agent Ecosystem"
Supervisor -->|Routing| Profile[Farmer Profile Agent]
Supervisor -->|Routing| Knowledge[Knowledge Support Agent]
Supervisor -->|Routing| Market[Market Intelligence Agent]
Supervisor -->|Routing| Weather[Weather Agent]
Supervisor -->|Routing| Disease[Plant Disease Agent]
end
subgraph "Core Services"
Knowledge -->|RAG Retrieval| RAG[RAG Service]
RAG -->|Hybrid Search| VectorDB[(FAISS + BM25)]
Profile <-->|Read/Write| DB[(MongoDB)]
AllAgents <-->|Context| Memory[Memory Service]
end
Disease -->|Image Analysis| VisionModel[Vision LLM]
end
- Modern Web Interface: Built with React 19, Vite, and Tailwind CSS for a premium, responsive experience.
- Robust RAG: Hybrid Search (FAISS + BM25) for accurate retrieval from agricultural manuals.
- MCP Integration: Uses Model Context Protocol to safely connect LLMs to live tools (Search, Weather).
- Multi-Modal: Supports Text and Image inputs for plant disease diagnosis.
- Context-Aware: Remembers user profile and active crops across sessions.
- Python 3.12+
- Node.js 18+
- MongoDB instance
Backend:
uv syncFrontend:
cd frontend
npm installCreate a .env file in the root directory:
OPENAI_API_KEY=sk-...
MONGO_URI=mongodb://...
MCP_PORT=8001Use the helper script to start Backend, Frontend, and MCP servers:
./run_farm_ai.sh├── backend/ # FastAPI Application & Agents
│ ├── agents/ # Agent definitions
│ ├── api/ # REST Endpoints
│ ├── core/ # Shared services
│ └── main.py # Entry point
├── frontend/ # React Application
│ ├── src/ # Components & Logic
│ └── index.html
├── EVAL/ # Evaluation scripts
├── knowledge_base/ # Raw PDF documents
└── run_farm_ai.sh # Startup script
- Fork the repo.
- Create a feature branch.
- Run tests and evaluation.
- Submit a Pull Request.
Built with ❤️ for generic farming communities.