An agentic multimodal AI dietitian assistant that helps users eat healthier, reduce food waste, and lower grocery spending.
For the polished hackathon narrative (inspiration, what it does, architecture, stack, challenges, and roadmap), see:
Many people want to eat healthier, waste less food, and reduce their environmental footprint.
Yet one simple question remains surprisingly difficult to answer every day: βWhat should I eat today?β
Food decisions are highly personal. The right choice depends on individual health goals, dietary restrictions, available ingredients, cooking time, and budget. However, most nutrition tools provide generic recommendations and mainly track what you have already eaten.
They rarely help users decide what to cook next, especially based on what is already in the fridge or what ingredients may expire soon.
As a result, everyday food decisions often lead to less healthy meals, wasted ingredients, and unnecessary grocery spending.
Build an Agentic AI Dietitian that understands a user's real food environment.
The system continuously reasons over:
- what users bought (receipt scans)
- what users have (fridge scans)
- what users ate (meal scans)
- what users want (goals and chat feedback)
Instead of passive tracking, the agent generates actionable meal plans and decision guidance.
This repository is a backend-first MVP using FastAPI + Railtracks architecture. The agent combines multimodal perception, user memory, constraint solving, recipe retrieval, and reflection checks to produce grounded recommendations with grocery optimization.
π View Full Interactive Diagram

The architecture spans five layers:
- User Input Layer β multimodal inputs (images, text, goals, pantry)
- Memory Injection Layer β build-time context + post-plan + feedback signal updates
- Railtracks Workflow Nodes β 7-step ReAct agent loop (Perceive β Prioritize β Retrieve β Query β Formulate β Reflect β Finalize)
- Tool & RAG Layer β 9 function-calling tools + ChromaDB semantic retrieval pipeline
- Output Nodes β structured
AgentPlanOutputV1(meal plan, grocery gap, execution plan, reflection, memory updates)
Sign Up and Set Goals -> Input Context -> Agent Loop -> Detailed Meal Plan Output -> User Feedback -> Agent Replans Automatically
- Sign Up and Set Goals: User profile and baseline health context (age, height, weight, activity, preferences, allergies). Set personal health goals for targeted calories, macro composition. Define food restrictions, budget and time availability etc.
- Provide Context: User submits fridge image, meal image, receipt image, and optional chat instructions.
- Agent Loop: System perceives, reasons over constraints, retrieves recipe knowledge, and generates strategy.
- Receive Output: Recipe recommendation, instructions, nutrition breakdown, substitutions, spoilage alerts, grocery gap.
- Feedback Loop: User requests changes (for example, vegetarian, lower calories, 15-minute cook time), and agent replans.
MVP boundary for hackathon: core planning, execution support, and memory feedback loop are in-scope.
- Receipt intelligence (extract purchased items into pantry state).
- Fridge intelligence (detect ingredients and spoilage risk hints).
- Meal recognition and automatic nutrition logging.
- Agentic nutrition planner (multi-constraint meal decision).
- Recipe retrieval via RAG-style pipeline (external recipe API in MVP).
- Smart grocery optimization (minimal missing-ingredient list).
- Local execution planning (calendar block + cooking DAG + proactive prep windows).
- Long-term memory metric updates (money saved, waste reduction, sustainability impact, preference memory).
- Health and sustainability impact dashboard.
- External calendar provider integrations.
- More advanced proactive scheduling optimization policies.
The orchestrator follows a ReAct-style loop:
- Perceive multimodal user inputs.
- Prioritize expiring items and hard constraints.
- Retrieve profile/history and recipe candidates.
- Query Recipe and formulate recommendation draft.
- Reflect to validate constraints before final response.
- Finalize Execution Plan (calendar + DAG + prep windows).
MVP tool contracts:
analyze_fridge_visionanalyze_meal_visionparse_receipt_itemsretrieve_recipe_candidatescalculate_meal_macrosgenerate_grocery_gapdecompose_cooking_workflowschedule_proactive_prepsync_to_calendar(local persistence)
- Short-term state: current session context and in-progress plan adjustments.
- Long-term state: persistent profile/goals/history plus favorite recipes, purchase patterns, money-saved metrics, food-waste metrics, and sustainability metrics.
Hard checks before final output:
- allergy and restriction compliance
- calorie/macro alignment
- spoilage-priority usage
- basic feasibility (ingredients, time)
The planner decides what to eat, and retrieval provides how to make it with grounded recipe instructions.
- Languages: Python (backend), Markdown (design/docs), JavaScript/TypeScript planned for frontend
- Backend: FastAPI
- Agent framework: Railtracks orchestrator
- Model provider: Google Gemini API
- Auth: AWS Cognito
- Database: SQLite memory-first + file snapshot storage
- Vector Store: Chroma memory-first + local snapshot/file modes
- Async processing: FastAPI
BackgroundTasks(MVP) - Cache/queue (optional): Redis (reserved)
- Recipe source: External recipe API (MVP)
git clone https://github.com/YiWang24/SmartDiet-Copilot.git
cd SmartDiet-CopilotBackend:
cd backend
uv sync
cp .env.example .env
uv run uvicorn app.main:app --reload --port 8000Notes:
- For planner, vision parsing, and vector embeddings, set
GEMINI_API_KEYinbackend/.env. - Input image URLs must be reachable by the backend service.
- Local deterministic test suite:
cd backend && uv run pytest -q
Frontend:
cd frontend
npm install
npm run devFrontend uses backend contracts in docs/api/openapi-contract.md.
If you do not have Cognito configured in local dev, backend auto-enables development auth bypass
(X-Demo-User) so the demo flow can run end-to-end.
- Create user profile and goals (or load seeded test user).
- Submit fridge scan, receipt scan, and meal scan inputs.
- Send a chat constraint (for example: "make it vegetarian and under 500 calories").
- Trigger planner recommendation endpoint.
- Show recipe output + nutrition summary + grocery gap.
- Send feedback patch (accept/reject + message).
- Trigger replan and show updated recommendation.
- Seed dataset:
backend/scripts/demo_seed.json - One-command walkthrough (server must be running):
backend/scripts/run_demo_flow.sh
- Placeholder:
TBD_BEFORE_SUBMISSION
- Expand multimodal inputs: integrate wearable health data (sleep, steps, heart rate) and lab results.
- Refine recipe retrieval: improve recipe diversity, filtering, and portion control.
- Calendar integrations: bi-directional sync for meal prep scheduling and grocery planning.
- Shopping integration: automatically order missing ingredients or suggest local alternatives.
- Social features: share meal plans and sustainability progress with friends.