Skip to content

MedouneSGB/AgriAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌾 AgriAgent β€” AI-Powered Agricultural Intelligence

Multi-agent platform that democratizes agricultural expertise for farmers worldwide β€” in French, English, and Wolof.

Built for the "Built with Claude: Claude Code Hackathon" (February 10–16, 2026).


🎯 The Problem

Over 500 million smallholder farmers worldwide lack access to timely, expert agricultural advice. Language barriers, costly consultants, and limited internet connectivity leave them making decisions based on incomplete information β€” leading to crop losses, pest damage, and missed market opportunities.

πŸ’‘ The Solution

AgriAgent is an autonomous multi-agent AI system powered by Claude Opus 4.6 that delivers personalized, real-time advice on weather, crop management, disease diagnosis, and market pricing β€” accessible via web, mobile, or SMS in the farmer's own language.


✨ Key Features

Feature Description
πŸ€– Multi-Agent Chat Orchestrator routes queries to specialized Weather, Agro, and Market agents running in parallel
πŸ“Έ Crop Photo Diagnosis Upload a photo β†’ Claude Vision identifies diseases and recommends treatments
🎀 Voice Input/Output Speech-to-text input + text-to-speech for responses (accessibility)
🌍 Interactive World Map Leaflet map with 20+ countries, agricultural data, and city-level weather
πŸ—“οΈ Agricultural Calendar Zone-specific planting calendars in grid and timeline views
🌱 Field Management Full CRUD for parcelles (fields), crops, season history, rotation advice
πŸ“Š Market Intelligence Crop prices by region with inter-city comparison
πŸ“± SMS Interface Text METEO, NJEG, TOOL, or JEGGE via Twilio β€” response in Wolof or French
πŸŒ— Dark/Light Theme Full theme support with CSS variables
🌐 Trilingual French, English, and Wolof across every page and notification
πŸ† Gamification Farmer levels, badges, and achievement stats
πŸ”” Smart Alerts AI-generated personalized alerts (weather, pests, market, calendar)

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    USERS                            β”‚
β”‚            Web Β· SMS Β· Voice                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              NEXT.JS 16 FRONTEND                    β”‚
β”‚     React 19 Β· Tailwind 4 Β· Framer Motion           β”‚
β”‚     Auth Β· i18n (FR/EN/WO) Β· Dark/Light             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ REST + SSE Streaming
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              FASTAPI BACKEND                        β”‚
β”‚        Supabase JWT Β· Public + Protected Routes     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            ORCHESTRATOR AGENT                       β”‚
β”‚         Claude Sonnet 4 Β· Keyword Routing           β”‚
β”‚      Auto Language Detection Β· Multi-Agent Sync     β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚             β”‚              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
β”‚ WEATHER     β”‚ β”‚  AGRO    β”‚ β”‚  MARKET    β”‚
β”‚ Claude 3    β”‚ β”‚ Claude 3 β”‚ β”‚  Claude 3  β”‚
β”‚ Haiku       β”‚ β”‚ Haiku    β”‚ β”‚  Haiku     β”‚
β”‚ +Open-Meteo β”‚ β”‚ +Crops   β”‚ β”‚  +Prices   β”‚
β”‚  Tool Use   β”‚ β”‚ +Disease β”‚ β”‚  +Compare  β”‚
β”‚  50+ cities β”‚ β”‚ +Zones   β”‚ β”‚  Tool Use  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Each agent uses Claude tool-use to call specialized functions (weather API, crop database, market data), then the orchestrator synthesizes a unified response.


πŸ› οΈ Tech Stack

Layer Technology
LLM Claude Sonnet 4 (orchestrator) + Claude 3 Haiku (sub-agents)
Backend Python 3.12 Β· FastAPI Β· Uvicorn
Frontend Next.js 16 Β· React 19 Β· TypeScript 5
Styling Tailwind CSS 4 Β· Framer Motion 12
Maps Leaflet Β· React-Leaflet
Auth Supabase (PostgreSQL Β· JWT Β· RLS)
SMS Twilio
Weather Open-Meteo API (free, no key required)
AI Vision Claude Vision (crop photo diagnosis)

πŸš€ Quick Start

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • Supabase project (free tier works)
  • Anthropic API key

1. Clone & Setup

git clone https://github.com/MedouneSGB/AgriAgent-SN.git
cd AgriAgent-SN

2. Backend

cd backend
pip install -r requirements.txt

Create backend/.env:

ANTHROPIC_API_KEY=sk-ant-...
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=eyJ...
SUPABASE_JWT_SECRET=your-jwt-secret
# Optional:
TWILIO_ACCOUNT_SID=AC...
TWILIO_AUTH_TOKEN=...
TWILIO_PHONE_NUMBER=+1...

Run the SQL migration in your Supabase dashboard:

# Copy backend/migration.sql into Supabase SQL Editor and execute

Start the server:

uvicorn main:app --reload --port 8095

3. Frontend

cd frontend
npm install

Create frontend/.env.local:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
NEXT_PUBLIC_API_URL=http://localhost:8095/api

Start the dev server:

npm run dev

Open http://localhost:3000 πŸŽ‰


πŸ“‘ API Endpoints

Public

Method Endpoint Description
POST /api/chat AI chat (JSON response)
POST /api/chat/stream AI chat (SSE streaming)
GET /api/weather/{city} 7-day forecast for 50+ cities
POST /api/diagnose Crop photo diagnosis (Vision)
POST /api/sms/incoming Twilio SMS webhook
GET /api/crops Crop database
GET /api/markets Market prices
GET /api/zones Agro-ecological zones
GET /api/cities City coordinates

Protected (JWT required)

Method Endpoint Description
GET/PUT /api/me User profile
GET/POST /api/parcelles Field management
GET/POST /api/cultures Crop tracking
GET/POST /api/history Season history
GET /api/alerts Personalized alerts
POST /api/alerts/generate AI-generate alerts
GET /api/calendar/{zone} Agricultural calendar
GET /api/rotation/{id} Crop rotation advice

🌍 Coverage

  • 50+ cities with weather data across 5 continents
  • 20+ countries with agricultural data (crops, zones, markets)
  • 16+ agro-ecological zones with specific crop calendars
  • 50+ crops with full growing guides
  • 3 languages β€” French, English, Wolof

πŸ“ Project Structure

agriagent/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py               # FastAPI app entry
β”‚   β”œβ”€β”€ api.py                # Public endpoints
β”‚   β”œβ”€β”€ api_protected.py      # JWT-protected endpoints
β”‚   β”œβ”€β”€ auth.py               # Supabase JWT verification
β”‚   β”œβ”€β”€ config.py             # Settings, cities, zones
β”‚   β”œβ”€β”€ data_loader.py        # JSON data loader
β”‚   β”œβ”€β”€ migration.sql         # Supabase DB schema + RLS
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ orchestrator.py   # Multi-agent router
β”‚   β”‚   β”œβ”€β”€ weather_agent.py  # Weather + Open-Meteo
β”‚   β”‚   β”œβ”€β”€ agro_agent.py     # Crops + diseases + zones
β”‚   β”‚   β”œβ”€β”€ market_agent.py   # Prices + comparison
β”‚   β”‚   └── alerts_agent.py   # AI alert generation
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ weather_service.py    # Open-Meteo client
β”‚   β”‚   β”œβ”€β”€ supabase_service.py   # Supabase client
β”‚   β”‚   └── sms_service.py        # Twilio SMS parsing
β”‚   └── data/
β”‚       β”œβ”€β”€ crops.json        # Crop knowledge base
β”‚       β”œβ”€β”€ diseases.json     # Disease/pest database
β”‚       β”œβ”€β”€ markets.json      # Market price data
β”‚       └── zones.json        # Agro-ecological zones
β”‚
β”œβ”€β”€ frontend/
β”‚   └── src/
β”‚       β”œβ”€β”€ app/              # Next.js pages (7 routes)
β”‚       β”œβ”€β”€ components/       # React components (12)
β”‚       β”œβ”€β”€ components/ui/    # Design system (14)
β”‚       β”œβ”€β”€ context/          # Auth, Language, Theme
β”‚       β”œβ”€β”€ lib/              # API client, Supabase
β”‚       └── data/             # World agriculture data
β”‚
└── .claude/docs/             # Project documentation

🀝 How Claude is Used

AgriAgent is built entirely on the Claude Opus 4.6 ecosystem, leveraging its capabilities across the entire stack:

  1. Claude Opus 4.6 β€” Powers the orchestrator agent for intelligent routing, language detection, and multi-agent synthesis
  2. Claude 3 Haiku β€” Fast sub-agents (weather, agro, market) with tool-use for real-time data access
  3. Claude Vision β€” Crop disease diagnosis from uploaded photos
  4. Tool Use β€” Each agent defines tools (functions) that Claude calls to fetch weather data, search crops, compare prices
  5. Multilingual β€” Claude generates responses in French, English, or Wolof based on detected language
  6. Streaming β€” SSE streaming for word-by-word chat responses
  7. Claude Code β€” The entire project was built using Claude Code as the development agent

πŸ“œ License

MIT β€” See LICENSE for details.


Built with ❀️ for the Claude Code Hackathon 2026
Empowering farmers worldwide with AI-driven agricultural intelligence

About

Multi-agent agricultural advisory system - Powered by Claude

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors