A Privacy-First AI System for Ethiopian Smallholder Farmers

Problem: Ethiopian smallholder farmers face increasing challenges from climate change, including erratic rainfall and soil degradation. While data-driven agriculture can offer solutions, traditional centralized systems risk exposing sensitive farm data (e.g., precise location, yields), leading to privacy concerns and lack of adoption.
Motivation: There is a critical need for a system that can provide personalized, climate-smart agricultural advice without compromising the privacy of individual farmers. This project aims to bridge the gap between advanced AI capabilities and data sovereignty.
Approach: We developed a Privacy-Preserving Multi-Agent System that utilizes Federated Learning (FL) principles and Differential Privacy (DP). The system consists of five specialized agents orchestrated by LangGraph. It processes sensitive data locally on the "farm" (simulated), aggregates insights using DP noise to mask individual contributions, and generates context-aware recommendations using Retrieval-Augmented Generation (RAG) with real-time climate data.
Key Outcomes: The system successfully generates personalized crop and weather plans while maintaining a high level of privacy. Benchmarks demonstrate that lower privacy budgets (epsilon < 0.5) significantly reduce the risk of membership inference attacks (success rate < 5%) while preserving the utility of the aggregated insights for regional trend analysis.
The system is built on a modular multi-agent architecture using LangGraph for orchestration. The workflow mimics a federated learning cycle:

The system architecture emphasizes privacy preservation, modularity, and fault tolerance. Each agent operates as an independent component with clearly defined responsibilities, enabling flexible orchestration and future extensibility. Sensitive user data remains confined within a local execution boundary, while higher-level planning relies solely on anonymized and aggregated insights. This design supports scalability across regions while maintaining strong privacy guarantees.
In addition to privacy and modularity, the architecture is explicitly designed to enhance system resilience through robust error-handling strategies and mechanisms for managing communication failures. These design considerations allow the workflow to remain operational under partial agent failures, intermittent connectivity, or transient execution errors, which are common in distributed and rural deployment contexts.
The following workflow diagram illustrates the end-to-end interaction between system components and highlights the integrated human-in-the-loop checkpoint within the decision-making process.
Workflow Diagram:
graph TD User[User Input] --> Local[Local Data Analyzer] Local -->|Anonymized Gradients| Federated[Federated Collaborator] Federated -->|Regional Trends| Planner[Crop/Weather Planner] Planner --> Auditor[Privacy Auditor] Auditor --> Human{Human Review} Human -- Approved --> Synthesizer[Synthesizer] Human -- Rejected --> Planner Synthesizer --> Output[Multilingual Report] subgraph Privacy Boundary Local end
gemini-1.5-flash to extract features (soil pH, crop type) from natural language input. It applies local differential privacy noise before any data leaves this node.To enhance the system's robustness in unstable network environments typical of rural deployments:
We integrated explicit Human-in-the-Loop (HITL) interaction to maximize user agency and trust:
We evaluated the system's resilience against Membership Inference Attacks, where an adversary attempts to determine if a specific user's data was included in the aggregated result.
Test Setup:
Findings:
| Epsilon (ε) | Attack Success Rate | Interpretation |
|---|---|---|
| 0.01 | 0.0000 | Perfect Privacy: The output is indistinguishable from noise. |
| 0.1 | 0.0100 | High Privacy: Extremely difficult for an adversary to infer membership. |
| 0.5 | 0.0480 | Strong Privacy: Good balance for most applications. |
| 1.0 | 0.0940 | Moderate Privacy: Acceptable for less sensitive data. |
| 5.0 | 0.3990 | Low Privacy: Higher utility but significant risk of leakage. |
Note: A success rate of ~0.0 implies the attack is no better than random guessing in this simplified model.
The Privacy-Preserving Multi-Agent Climate-Resilient Farming Advisor demonstrates that it is possible to leverage the power of modern AI and collaborative learning without compromising the digital sovereignty of smallholder farmers. By embedding privacy by design via Federated Learning and Differential Privacy, we pave the way for more trustworthy and scalable digital agriculture solutions.
Clone the Repository
git clone https://github.com/Amanatal11/ethio-climate-agri-advisor.git cd ethio-climate-agri-advisor
Set Up Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
Install Dependencies
pip install -r requirements.txt
Configure Environment Variables
Create a .env file in the root directory:
cp .env.example .env
Edit .env and add your API keys:
GOOGLE_API_KEY=your_google_api_key_here TAVILY_API_KEY=your_tavily_api_key_here # Optional defaults DEFAULT_MODEL_NAME=gemini-1.5-flash
Run the advisor demo:
python src/ethio_agri_advisor/main.py
The system will guide you through the following steps:
yes to approve or provide feedback to refine.