A multi-agent AI system where farmers describe crop problems in plain language and four specialized AI agents collaborate concurrently to diagnose, recommend treatment, estimate costs, and advise on timing.
Built with Python, Google ADK, Gemini API, and Flask. Presented at GDG Ilorin Build with AI 2026.
User Query
│
▼
┌─────────────────────┐
│ agrialert_orchestrator │ ← Root ADK Agent
│ (root_agent) │ delegates via sub_agents
└──────────┬────────────┘
│ ADK sub_agents
┌────────┼────────┬──────────┐
▼ ▼ ▼ ▼
Diag Treat Market Weather
Agent Agent Agent Agent
│ │ │ │
└────────┼────────┼──────────┘
▼
Synthesized report
(final response from root agent)
| Agent | Role | What it returns |
|---|---|---|
| Diagnosis | Identifies disease/pest from symptoms | Disease name, confidence, symptoms matched |
| Treatment | Recommends organic + chemical remedies | Treatment options, application method |
| Market | Estimates costs for inputs | Product names, price ranges (NGN), where to buy |
| Weather | Advises on treatment timing | Best application time, seasonal advice |
| Orchestrator | Delegates to sub-agents, synthesizes results | Farmer-friendly report with all sections |
git clone https://github.com/YOUR_USERNAME/agrialert.git
cd agrialert
pip install -r requirements.txtGet a free key from AI Studio:
export GOOGLE_API_KEY="your-key-here"python app.pyOpen http://localhost:8080 in your browser.
If using Cloud Shell, use Web Preview on port 8080 after starting the server.
agrialert/
├── agents/
│ ├── __init__.py
│ └── agents.py # 4 specialist ADK agents + orchestrator
├── templates/
│ └── index.html # Frontend with agent pipeline visualization
├── agrialert-multi-agent/ # Generated codelab (hosted on Netlify)
├── app.py # Flask server
├── requirements.txt
├── agrialert-codelab.md # Google Codelab source (claat format)
└── README.md
Why ADK? Google ADK provides declared Agent objects, native sub_agents delegation, built-in session management (InMemorySessionService), and an async Runner — so we don’t have to manually manage agent calls, routing, or state.
Why separate agents instead of one big prompt? Each agent has a focused system instruction, making outputs more reliable and the system easier to debug and extend.
Why does the orchestrator synthesize? The root agent delegates to each specialist via sub_agents, then combines their outputs into a single farmer-friendly report — all within ADK’s event-driven loop.
- Add image upload for crop photos (Gemini Vision)
- Add agent-to-agent communication — let the Treatment Agent read the Diagnosis Agent’s output
- Add ADK tools (
@tooldecorated functions) so agents can call real APIs for live weather and market data - Replace
InMemorySessionServicewithDatabaseSessionServicefor persistent memory - Use ADK’s
ParallelAgentwrapper for true parallel agent execution
- Python 3.10+
- Google ADK (
google-adk) - Google Gemini API (
google-genai) - Flask
- HTML/CSS/JS (no framework)
MIT