Swarm and map-reduce
The swarm pattern is parallelisation. When the job needs parallel processing, not sequential, such as summarising 10,000 articles, a queen agent spawns a worker agent for each task. The workers are interchangeable, so any of them can be swapped. Microsoft’s guide files the same idea under concurrent orchestration, also called fan-out and fan-in.
Map and reduce
The shape is map-reduce. Map: take the list as input and spawn a worker for each task. Reduce: wait for every worker to finish, collect the results and finalise.
In LangGraph
The map step returns one Send per item, so the number of workers is decided at run time. A reducer on the state field (operator.add) merges what the parallel workers write, and the reduce node runs only after all of them finish.
import operatorfrom typing import Annotated, TypedDictfrom langgraph.graph import StateGraph, START, ENDfrom langgraph.types import Send class State(TypedDict): articles: list[str] summaries: Annotated[list[str], operator.add] # reducer merges parallel writes digest: str class Job(TypedDict): article: str def spawn(state: State): # map: one worker per article return [Send("worker", {"article": a}) for a in state["articles"]] def worker(job: Job): return {"summaries": [job["article"][:20] + "..."]} # an LLM summary in practice def reduce(state: State): # reduce: runs after every worker is done return {"digest": "\n".join(state["summaries"])} builder = StateGraph(State)builder.add_node("worker", worker)builder.add_node("reduce", reduce)builder.add_conditional_edges(START, spawn, ["worker"])builder.add_edge("worker", "reduce")builder.add_edge("reduce", END)graph = builder.compile()Why use it
Massive speed and scale. Anthropic reports that running subagents in parallel cut research time by up to 90% on complex queries.
The catch
Expensive. Every worker pays for its own context, and multi-agent runs used about 15× the tokens of a chat in Anthropic’s system. It only fits jobs that split into independent parts, so work where each step needs the last one belongs in a sequenceHandoff patternAgents in a fixed sequence, each passing its output to the next.Opens in a new tab. And it adds complexity: merging results, and deciding what happens when one worker fails.
Sources
- Use the graph API, LangGraph Docs · accessed October 5, 2026
- AI Agent Orchestration Patterns, Microsoft Azure Architecture Center · accessed October 5, 2026
- How we built our multi-agent research system, Anthropic · accessed October 5, 2026