# Building a Book Recommendation Pipeline with LangGraph’s MapReduce Pattern

> Source: <https://pub.towardsai.net/building-a-book-recommendation-pipeline-with-langgraphs-mapreduce-pattern-15869cc39094?source=rss----98111c9905da---4>
> Published: 2026-07-28 06:33:21+00:00

Member-only story

# Building a Book Recommendation Pipeline with LangGraph’s MapReduce Pattern

**MapReduce** is a way to process a list of items and combine the results into a single output.

The idea has two steps:

**Map**: Process each item in the list separately.** Reduce**: Combine all the individual results into one final result.

This pattern is commonly used in distributed systems, but it is also useful in LLM applications.

In an LLM workflow, the **map** step often means taking a list generated by one model call and running a separate model call (or API call) for each item. The **reduce** step then combines all those results with a final model call.

In **LangGraph**, this pattern is implemented using **Send**. In this article, I will build a simple **book recommendation workflow** to show *how **Send** distributes work across multiple parallel tasks and then combines the results into a final output.*

## The Problem with a Fixed Graph

A standard LangGraph graph has a **fixed** set of nodes and edges. This works well when the number of steps is known **in advance**. It becomes difficult when the number of steps depends on the data received at** runtime**.

For example — suppose a user asks for book recommendations on the **history of the Football World Cup**. The first LLM call may return 2 books, 4 books, or even 10. The graph doesn’t know this until that call finishes.
