Skip to content

Send and parallel fan-out

Send creates a dynamic call to a node with its own input. Return several Send objects to fan work out in parallel, then merge results through a reducer.1

import operator
from typing import Annotated
from langgraph.types import Send
class ResearchState(TypedDict):
urls: list[str]
summaries: Annotated[list[str], operator.add]
def fan_out(state: ResearchState):
return [Send("summarize", {"url": url}) for url in state["urls"]]
def summarize(state: dict) -> dict:
return {"summaries": [fetch_summary(state["url"])]}
  1. Router sees three URLs.
  2. It returns three Send("summarize", ...) values.
  3. Three node calls run concurrently.
  4. The reducer combines their summaries.

Cap fan-out and invocation concurrency. Parallel calls can overload an API, and results should not rely on completion order. Side-effecting workers need idempotency keys.

  1. LangChain, Use the graph API — Map-reduce and the Send API.