Your AI-powered nutrition co-pilot with full observability
NutriPilot transforms food photos into personalized nutrition insights using a multi-agent ReAct architecture. Built for the "Commit to Change" AI Agents Hackathon.
Manual nutrition tracking is:
- Tedious: Logging a complex meal takes 10-15 minutes
- Inaccurate: Portion estimation errors of 30-50% are common
- Impersonal: Generic apps ignore your health goals and conditions
NutriPilot uses Gemini 2.0 Flash vision capabilities to:
- 📸 Instant Analysis: Upload a food photo → get complete nutrition breakdown in seconds
- 🎯 Goal-Personalized Feedback: Recommendations tailored to your health goals (weight loss, diabetes, heart health)
- 📊 Self-Improving: Calibration system learns from verified meals to improve accuracy
- 🔍 Fully Observable: Every AI decision traceable via Comet Opik
┌─────────────────────────────────────────────────────────────┐
│ Next.js Frontend │
└─────────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ FastAPI Backend │
└─────────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ StudioOrchestrator (ReAct Pattern) │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ OBSERVE │ ──▶│ THINK │ ──▶│ ACT │ │
│ └─────────┘ └─────────┘ └─────────┘ │
└────────┬────────────┬───────────────┬───────────────────────┘
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│VisionAnalyst │ │ NutriAuditor │ │GoalEvaluator │
│ (Gemini 2.0) │ │ (USDA API) │ │ (Personalize)│
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
└────────────┴───────────────┘
│
▼
┌──────────────────┐
│ Comet Opik │
│ (Observability) │
└──────────────────┘
| Agent | Role | Technology |
|---|---|---|
| VisionAnalyst | Food detection & portion estimation | Gemini 2.0 Flash Vision |
| BioDataScout | Fetch user health constraints | HealthKit (mock) |
| NutriAuditor | Validate nutrition data | USDA FoodData Central API |
| GoalEvaluator | Personalize recommendations | Goal-based rule engine |
| NutriCalibrator | Improve accuracy from feedback | Opik trace analysis |
- Python 3.11+
- Node.js 18+
- API Keys: Gemini, Opik, USDA (optional)
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API keys
# Run server
uvicorn app.main:app --reload --port 8000cd frontend
npm install
# Configure environment
cp .env.example .env.local
# Edit .env.local if needed
# Run dev server
npm run devVisit http://localhost:3000 to use NutriPilot!
# Upload any food image
POST /analyze
Content-Type: multipart/form-data
image: <food_photo.jpg>
user_id: demo_userResponse includes:
- Detected foods with portions
- Complete macronutrient breakdown
- Goal-specific feedback
- Overall meal score
Supported goals:
- 🏃 Weight Loss / Weight Gain
- 💪 Muscle Building
- ❤️ Heart Health
- 🩺 Diabetes Management
- ⚡ Energy & Vitality
The calibration system:
- Collects Opik traces from meal analyses
- Compares estimated vs verified calories
- Identifies systematic errors (e.g., "fried foods underestimated")
- Generates prompt improvement suggestions
Every request is traced:
orchestrator.process- Full analysis flowvision_analyst.process- Image analysisnutri_auditor.process- Nutrition validationgoal_evaluator.process- Personalization
nutripilot/
├── backend/
│ ├── app/
│ │ ├── agents/ # AI agents
│ │ │ ├── vision_analyst.py
│ │ │ ├── nutri_auditor.py
│ │ │ ├── goal_evaluator.py
│ │ │ └── nutri_calibrator.py
│ │ ├── core/ # Orchestrator, state, schemas
│ │ ├── tools/ # External API wrappers
│ │ └── main.py # FastAPI app
│ └── requirements.txt
├── frontend/
│ ├── app/ # Next.js pages
│ ├── components/ # React components
│ │ ├── ImageUpload.tsx
│ │ ├── AnalysisResults.tsx
│ │ ├── Dashboard.tsx
│ │ └── CalibrationReport.tsx
│ └── package.json
├── opik_evals/ # Evaluation framework
│ ├── actionability_metric.py
│ ├── goal_adherence_metric.py
│ └── production_eval.py
└── README.md
Run the evaluation suite:
cd opik_evals
pip install -r requirements.txt
python run_evaluation.pyCustom metrics:
- Actionability Score: Are suggestions specific and actionable?
- Goal Adherence Score: Does feedback align with user goals?
| Layer | Technology |
|---|---|
| LLM | Google Gemini 2.0 Flash |
| Backend | FastAPI, Pydantic v2 |
| Frontend | Next.js 14, React, Tailwind CSS |
| Observability | Comet Opik |
| Data | USDA FoodData Central API |
Built with ❤️ for the Commit to Change: An AI Agents Hackathon
MIT License - see LICENSE for details.
