File size: 623 Bytes
1f725d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import logging
from src.Blog.models.State_model import State
from langgraph.types import Send


def fanout(state: State):
    logging.info("Entering fanout")
    tasks = state["plan"].tasks
    logging.debug(f"Fanning out {len(tasks)} tasks")
    
    return [
        Send(
            "worker",
            {
                "task": task.model_dump(),
                "topic": state["topic"],
                "mode": state["mode"],
                "plan": state["plan"].model_dump(),
                "evidence": [e.model_dump() for e in state.get("evidence", [])],
            },
        )
        for task in tasks
    ]