LangGraph 1 · Building graphs

Fan out to parallel workers

Return Send objects from a conditional edge to run one node per item, for example map-reduce.

from langgraph.types import Send

def fan_out(state):
    return [Send("worker", {"item": item}) for item in state["items"]]

builder.add_conditional_edges(START, fan_out, ["worker"])

Official LangGraph 1 documentation

More building graphs commands

All building graphs commands · LangGraph 1 cheatsheet

Was this page helpful?