feat(orchestrator): Implement Delegate node for task routing
This commit is contained in:
18
backend/src/ea_chatbot/graph/nodes/delegate.py
Normal file
18
backend/src/ea_chatbot/graph/nodes/delegate.py
Normal 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}
|
||||
Reference in New Issue
Block a user