A multi-agent system using Google ADK that adapts recipes, suggests substitutions, and generates macro-optimized shopping lists.
- Generate recipes based on calorie and protein goals
- Suggest ingredient substitutions
- Create shopping lists
- Optimize for budget
- Meal prep scheduling
- Web search for recipes and prices
- Accurate macro calculations
User Input
↓
Runner/InMemoryRunner
↓
MacroForge Agent - Orchestrator
↓
┌────────────────────────────────────────┐
│ AgentTools (wrapped specialists) │
├────────────────────────────────────────┤
│ RecipeGenerator (+ google_search) │
│ MacroCalculator (+ custom tools) │
│ SubstitutionExpert │
│ ShoppingListAgent (+ google_search) │
└────────────────────────────────────────┘
↓
Results → Orchestrator → User
macroforge_agent/
├── __init__.py # Package initialization
├── nutrition_db.py # Nutrition database (macros per 100g)
├── tools.py # Custom tools (macro calculator, adjustments)
├── agents.py # Specialized agents definitions
├── plugins.py # Custom plugins for monitoring
├── orchestrator.py # Main orchestrator and runner setup
├── main.py # Entry point with demo and interactive modes
├── requirements.txt # Python dependencies
└── README.md # This file
pip install -r requirements.txtSet your Google API key:
export GOOGLE_API_KEY="your-api-key"Or if running on Kaggle, add GOOGLE_API_KEY to your Kaggle secrets.
python -m macroforge_agent.mainimport asyncio
from macroforge_agent.orchestrator import create_runner, run_session
async def main():
runner = create_runner()
await run_session(runner, "Create a 500 calorie breakfast with 30g protein")
asyncio.run(main())import asyncio
from macroforge_agent.orchestrator import create_runner
async def main():
runner = create_runner()
await runner.run_debug("Calculate macros for 150g chicken and 200g rice")
asyncio.run(main())import asyncio
from macroforge_agent.orchestrator import create_runner_with_plugins
async def main():
runner = create_runner_with_plugins()
await runner.run_debug("Create a high-protein lunch")
asyncio.run(main())calculate_recipe_macros- Precise macro calculations from ingredientssuggest_macro_adjustments- Recommendations to hit targets
google_search- Web search for recipes, prices, tips
RecipeGenerator- Creates recipes + google_searchMacroCalculator- Calculates/validates macrosSubstitutionExpert- Suggests alternativesShoppingListAgent- Shopping + prices + google_search
- Retry Logic: All agents retry on 429, 500, 503, 504 errors (5 attempts)
- Web Search: RecipeGenerator and ShoppingListAgent can search online
- Precise Macros: Custom calculator for accurate nutrition data
- Smart Routing: Orchestrator chains agents for complete workflows
- Memory: Shared memory across sessions for personalization