Cloud-Native Precision Agriculture AI Platform
AgriAI is a multi-agent microservices architecture deployed on AWS. It provides a unified farm analysis report by orchestrating three core ML services:
- Disease Detection Service: CNN (EfficientNet-B3) for detecting 38 crop diseases (PlantVillage taxonomy). Includes GradCAM visual explainability.
- Weather Prediction Service: TCN (Temporal Convolutional Network) for 24-hour forecasting using historical Open-Meteo data. Uses MC Dropout for uncertainty estimation.
- Market Analytics Service: XGBoost and Ridge Regression models predicting crop yields and market prices, combined with an SLSQP portfolio optimizer for land allocation.
- Orchestration Agent: FastAPI service managing parallel, fault-tolerant execution of the above services. Synthesizes data into an actionable
FarmInsightReport.
config/: Shared configuration and constants.shared/: Common utilities (JWT Auth, Logging, AWS Clients).services/: Microservices (Disease, Weather, Market, Orchestrator).infrastructure/: Terraform configurations and Lambda processors.pipelines/: Data acquisition and retraining scripts.tests/: Pytest suite.scripts/: Deployment and model download helpers.
-
Download Models:
./scripts/download_models.sh
(Note: This creates mock models locally. In production, it downloads from S3).
-
Start LocalStack and Services:
docker-compose up -d
-
Run Tests: Ensure
AWS_ENDPOINT_URL=http://localhost:4566is set.pytest tests/
- Orchestrator:
http://localhost:8000/docs - Disease Detection:
http://localhost:8001/docs - Weather Prediction:
http://localhost:8002/docs - Market Analytics:
http://localhost:8003/docs
curl -X POST "http://localhost:8000/analyze/farm" \
-H "Authorization: Bearer <token>" \
-F "image=@/path/to/leaf.jpg" \
-F "sensors=@/path/to/sensors.csv" \
-F 'farm_metadata={"crop_type": "corn", "soil_quality": 85.0, "fertilizer_kg_ha": 120.0, "water_mm": 400.0}'- Configure AWS Credentials.
- Run deployment script:
This applies Terraform and pushes Docker images to ECR.
./scripts/deploy.sh
