madia / graph /nodes.py
hamba-ho's picture
feat: implement Madia multi-agent debate app
1110d29
Raw
History Blame Contribute Delete
1.01 kB
"""
Graph nodes — wrapper functions that plug agents into the LangGraph workflow.
Each node function takes DebateState, calls the corresponding agent,
and returns the state update.
"""
from agents.chef import run_chef
from agents.eco import run_eco
from agents.moderator import run_moderator
from agents.nutrition import run_nutrition
from graph.state import DebateState
def chef_node(state: DebateState) -> dict:
"""Chef agent node."""
return run_chef(state)
def nutrition_node(state: DebateState) -> dict:
"""Nutrition agent node."""
return run_nutrition(state)
def eco_node(state: DebateState) -> dict:
"""Éco agent node."""
return run_eco(state)
def moderator_node(state: DebateState) -> dict:
"""
Modérateur agent node.
After the moderator speaks, increment the round counter.
"""
result = run_moderator(state)
# Increment the round after the moderator finishes
result["current_round"] = state.get("current_round", 1) + 1
return result