↓ Skip to main content
  1. Posts/

LangChain Or LangGraph For Agents

··204 words·1 min·

LangChain and LangGraph do not compete: LangGraph is part of the LangChain ecosystem. The difference is the kind of workflow we want to build. 🔗

LangChain models linear pipelines: retrieve documents, generate an answer, and return it. It is ideal for predictable tasks. LangGraph models graphs with nodes, transitions, and loops, so an agent can revisit steps, retry, or choose conditional paths.

It also adds persistent state. Instead of manually rebuilding history, errors, and results, the graph maintains a shared schema. Interrupts can pause an action for human approval, while checkpointers save snapshots so a failed workflow can resume without repeating everything.

💡 Explanation in a nutshell
#

Use LangChain like a recipe with forward-moving steps. Use LangGraph like a flowchart that remembers its position, can go back, and waits for decisions. A simple RAG fits the first; an assistant that generates, tests, and repairs code fits the second.

The choice depends on whether control flow or persistence is central to the product.

More information at the link 👇

Also published on LinkedIn.

Juan Pedro Bretti Mandarano
Author
Juan Pedro Bretti Mandarano