Inspiration
Massive amounts of edible food go to waste daily across restaurants, supermarkets, hostels, and catering services. Meanwhile, local food banks, shelters, and community kitchens constantly struggle with supply shortages and unpredictable donations.
The underlying problem isn't a lack of food—it's a massive coordination and prediction failure. Traditional food donation relies on manual, reactive phone calls, which often results in cooked food spoiling before it can be collected. We built FoodLoop AI to transform food rescue from a reactive hassle into an automated, data-driven pipeline that predicts excess food before it occurs and routes it to nearby organizations in real time.
What it does
FoodLoop AI is an intelligent food rescue and surplus management ecosystem that automatically balances food excess with community demand:
- Predictive Surplus Engine: Uses machine learning to forecast potential end-of-day surplus inventory based on historical prep vs. sales data.
- Perishability Categorization: Auto-classifies food into urgency tiers based on safety shelf-life (e.g., hot meals with a 3-hour window vs. shelf-stable bakery items).
- Geospatial & Urgency Matching: Matches donors with the nearest eligible charity using exact geodesic distance matrices and real-time shelter demand.
- Autonomous AI Agent Orchestration: Dynamically coordinates multi-donor to multi-recipient dispatch plans, ensuring optimal portion splits and route priorities.
- Real-time Analytics Dashboard: Tracks total rescued volume, demand fulfillment percentages, and estimated carbon offset ($\text{CO}_2\text{e}$).
How we built it
We built FoodLoop AI using a modern, scalable AI and web stack:
- Machine Learning & Surplus Prediction: Built with Scikit-learn and XGBoost to train predictive models on sales and prep patterns.
- Autonomous AI Agent: Driven by LangGraph to handle multi-step decision chains, dynamic batching, and supply-demand balancing.
- Geospatial Processing: Integrated Geopy to calculate exact geodesic distance matrices and optimal routing priorities.
- Backend Framework: Core APIs built using FastAPI to connect machine learning models, database queries, and live dispatch routes asynchronously.
- Database Management: Managed through PostgreSQL to securely track donor profiles, real-time recipient needs, and historical transaction logs.
- Dashboard & Visualizations: Interactive frontend built with Streamlit and Plotly for real-time visualization of dispatch metrics and environmental impact.
Challenges we ran into
- Perishability vs. Proximity Trade-offs: Balancing simple distance against strict expiry times was non-trivial. A recipient 1 km away might need shelf-stable goods, while hot meals 3 km away require immediate routing. We had to tune our algorithm to prioritize food safety windows without inflating transit times.
- Dynamic Demand Splitting: Large catering surpluses (e.g., 110 servings) often exceed the capacity of a single small shelter. Structuring the AI agent to intelligently split batches across multiple nearby shelters based on remaining demand while keeping routes efficient required several iterations.
- Asynchronous Orchestration: Ensuring seamless data flows from ML prediction outputs to LangGraph agent execution and FastAPI endpoints without introducing web latency.
Accomplishments that we're proud of
- End-to-End Autonomous Pipeline: Successfully demonstrated an end-to-end flow where surplus entered across multiple restaurants automatically routes to nearby shelters in seconds.
- Zero-Waste Allocation in Simulations: Achieved a 100% allocation rate for simulated multi-donor scenarios, preventing edible food from reaching landfills.
- Granular Expiry-Aware Routing: Created a dispatch algorithm that actively prioritizes high-risk, fast-perishing cooked items over low-risk shelf-stable goods.
What we learned
- Data Quality Drives Food Safety: Accurate timestamping and initial perishability tagging are critical; minor errors in estimated shelf-life drastically shift dispatch priorities.
- Agentic Decision Making: Stateful agent frameworks like LangGraph are effective for complex logistics problems where rules shift dynamically based on real-world constraints.
- Logistical Simplification for Donors: Food donors need zero-friction tools—if logging surplus takes more than a few clicks, adoption drops significantly.
What's next for FoodLoop AI — Smart Food Rescue & Waste Prediction Platform
- Real-Time Volunteer & Courier Fleet Integration: Integrating Third-Party Logistics (3PL) and local volunteer network APIs for automated driver assignment.
- IoT Cold-Chain & Expiry Sensors: Incorporating smart temperature sensors to monitor food safety during transit in real time.
- Hyper-Local POS Integrations: Connecting directly with restaurant Point-of-Sale (POS) systems to calculate surplus automatically without manual inventory entry.
- Tax Invoicing & ESG Reporting: Building automated tax-deduction documentation for donors and verified ESG carbon-credit reporting for corporate sustainability compliance.
Built With
- ai
- carbon-offset
- fastapi
- food-rescue
- food-waste-reduction
- geopy
- geospatial-analysis
- langgraph
- logistics-optimization
- machine-learning
- plotly
- postgresql
- python
- scikit-learn
- smart-city
- streamlit
- sustainability
- xgboost
