feat(orchestrator): Implement Delegate node for task routing

This commit is contained in:
Yunxiao Xu
2026-02-23 05:28:02 -08:00
parent 575e1a2e53
commit ff9b443bfe
2 changed files with 74 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
from ea_chatbot.graph.state import AgentState
from ea_chatbot.utils.logging import get_logger
def delegate_node(state: AgentState) -> dict:
"""Determine which worker subgraph to call next based on the checklist."""
checklist = state.get("checklist", [])
current_step = state.get("current_step", 0)
logger = get_logger("orchestrator:delegate")
if not checklist or current_step >= len(checklist):
logger.info("Checklist complete or empty. Routing to summarizer.")
return {"next_action": "summarize"}
task_info = checklist[current_step]
worker = task_info.get("worker", "data_analyst")
logger.info(f"Delegating next task to worker: {worker}")
return {"next_action": worker}