Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MacroForge Agent: Recipe Adaptation Engine

A multi-agent system using Google ADK that adapts recipes, suggests substitutions, and generates macro-optimized shopping lists.

Features

  • 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

Architecture

User Input
    ↓
Runner/InMemoryRunner
    ↓
MacroForge Agent - Orchestrator
    ↓
┌────────────────────────────────────────┐
│  AgentTools (wrapped specialists)      │
├────────────────────────────────────────┤
│  RecipeGenerator (+ google_search)     │
│  MacroCalculator (+ custom tools)      │
│  SubstitutionExpert                    │
│  ShoppingListAgent (+ google_search)   │
└────────────────────────────────────────┘
    ↓
Results → Orchestrator → User

Project Structure

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

Installation

pip install -r requirements.txt

Setup

Set your Google API key:

export GOOGLE_API_KEY="your-api-key"

Or if running on Kaggle, add GOOGLE_API_KEY to your Kaggle secrets.

Usage

Run as a module

python -m macroforge_agent.main

Programmatic usage

import 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())

Using the debug runner

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())

With plugins

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())

Components

Custom Tools

  • calculate_recipe_macros - Precise macro calculations from ingredients
  • suggest_macro_adjustments - Recommendations to hit targets

Built-in Tools

  • google_search - Web search for recipes, prices, tips

Specialized Agents

  • RecipeGenerator - Creates recipes + google_search
  • MacroCalculator - Calculates/validates macros
  • SubstitutionExpert - Suggests alternatives
  • ShoppingListAgent - Shopping + prices + google_search

Key Features

  • 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

About

A multi-agent system for bodybuilders and fitness enthusiasts optimize their nutrition.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages