LlamaIndex vs LangChain for RAG: Which to Use, and How to Evaluate the Result
LlamaIndex vs LangChain for RAG: differences, similarities, pros and cons, and how to evaluate which one works on your documents before you commit.
What is LangGraph, and why do teams building production agent systems reach for it?
Start with the problem it solves. A single agent loop works well in a notebook: it calls a tool, reads the result and answers.
Then the real system arrives. It has a dozen agents, retries when an output fails a check, a person who must approve the result, and runs that take minutes instead of seconds.
That system breaks in ways the demo never did. An agent overwrites another agent's work, a retry loses context, and a crash halfway through means starting again. LangGraph exists to keep the state of a system like that straight.
We build multi-agent systems for clients, including a LangGraph network of roughly fourteen agents for a Fortune 400 client. Things like explicit state, validation loops, and parallel execution is what made that system work, and it is also why LangGraph is the wrong choice for simpler jobs.
LangGraph is an open-source framework from LangChain for building AI agents and multi-agent applications as graphs. A shared state object passes through nodes connected by edges, including loops and conditional branches, and the framework saves that state as the graph runs.
The LangGraph documentation describes it as "a low-level orchestration framework and runtime for building, managing, and deploying long-running, stateful agents." Low-level is the important word. LangGraph does not decide how your agent should think; it gives you granular control over what runs, in what order, with what state.
I find the precise control over the structure of agent flows to be incredibly valuable in systems where you want agents to be able to perform complex tasks in an open domain, but you want control over the flow with validations and guardrails.
LangChain is the higher-level framework: models, tools, retrievers, document loaders and a prebuilt agent loop. LangGraph is the runtime underneath LangChain agents. You can use LangGraph without LangChain's components, and the docs say so directly.
LangSmith is the third piece of the LangChain ecosystem. It provides tracing, evaluation and deployment for agents built with either, and it works with other frameworks too. LangGraph Platform is now called LangSmith Deployment, and LangGraph Studio is now LangSmith Studio.
A LangGraph application is a graph structure, much like a state machine, that you define in code. The table summarizes the core concepts, and the sections after it explain why each one matters once a system is in production.

State is a typed schema, usually a Python TypedDict or a Pydantic model, that every node reads and updates. Reducers decide how updates merge: one field can be overwritten, while a messages field appends. The Graph API docs show operator.add as a simple reducer.
This matters because a production system needs one record of what happened. When ten agents write to the same run, reducers stop them overwriting each other, and the state tells you exactly what each step saw.
Nodes do the work. Each is a function, often an LLM call or an agent, that reads the state and returns an update. Edges decide what runs next. A normal edge always goes to the same node; a conditional edge picks the next node from the state, which gives you dynamic routing.
Conditional edges make the loops in cyclical graphs explicit. A validate node can send a failed draft back to the generate node with feedback, up to a set number of attempts. In a free-running agent that conditional logic hides in prompt engineering; in LangGraph it is a line of code you can read and test.
A checkpointer saves the state after each step. The core options in the persistence docs are in-memory, SQLite and Postgres. Redis and MongoDB checkpointers are available as separate packages. Each run belongs to a thread, so a conversation or job can be picked up later.
Checkpoints give you three things. A run can resume after a crash instead of starting over. An agent can keep memory of user inputs and past actions across turns. And with time travel, you can replay a past run or fork it from an earlier step to explore a different path, which is a powerful debugging tool.
An interrupt pauses a graph mid-run for human input, so a person can approve, edit or reject what an agent produced. The run waits, with its state saved, and resumes at the interrupted node when the person responds. That node reruns from its start, so code before the interrupt runs again. Interrupts need a checkpointer, because the state has to survive the wait.
A subgraph is a graph used as a node inside another graph, which keeps large systems modular. LangChain's multi-agent docs now describe the main patterns as subagents called as tools, handoffs between agents, skills, routers that pick an agent, and custom workflows.
LangGraph streams tokens, state updates and custom events while a graph runs. Users see progress, and engineers see each step as it happens rather than after the run ends.
LangGraph offers two ways to write the same thing. The Graph API, used in the example below, models workflows as explicit nodes and edges. The Functional API adds LangGraph features, such as checkpoints and interrupts, to ordinary Python functions with decorators.
Use the Graph API when the shape of the workflow matters and you want to see it. Use the Functional API to adapt existing workflows, adding durability to code that already exists. Both run on the same runtime.
Agent systems fail in ways that are hard to see from the outside. An answer is wrong, but which step went wrong? LangSmith records a trace for every run: each node, each model call, the inputs and outputs, the tokens, the timing and other critical data points.
Pair traces with checkpoints and debugging becomes concrete. You find the step that failed, load the state from just before it, change the code or the prompt, and replay from that point. That loop is much faster than rerunning a long job from the start.
Here is a two-node graph with a conditional retry edge. It generates a product title, validates its length and makes up to three attempts. The write_title function stands in for your LLM call.
from typing import TypedDict
from langgraph.graph import StateGraph, START, END
from langgraph.checkpoint.memory import InMemorySaver
class State(TypedDict):
draft: str
attempts: int
passed: bool
def generate(state: State) -> dict:
draft = write_title(state) # your LLM call
return {"draft": draft, "attempts": state["attempts"] + 1}
def validate(state: State) -> dict:
return {"passed": len(state["draft"]) <= 200}
def route(state: State) -> str:
if state["passed"] or state["attempts"] >= 3:
return END
return "generate" # retry with the same state
builder = StateGraph(State)
builder.add_node("generate", generate)
builder.add_node("validate", validate)
builder.add_edge(START, "generate")
builder.add_edge("generate", "validate")
builder.add_conditional_edges("validate", route)
graph = builder.compile(checkpointer=InMemorySaver())
graph.invoke({"draft": "", "attempts": 0, "passed": False},
{"configurable": {"thread_id": "sku-123"}})The design behind this is deliberate. In Building LangGraph, LangChain explains that it built on the BSP/Pregel algorithm: the runtime runs in steps, supports loops and saves snapshots of the computation state at intermediate stages. The documentation also credits Pregel and Apache Beam as inspiration.
What is LangGraph used for in practice? Complex task automation, wherever an agent system needs control, durability or review. The common patterns are:
LangChain lists deployments on its Built with LangGraph page. It says Klarna's assistant serves 85 million active users and cut customer resolution time by 80%, and that AppFolio doubled response accuracy and saved more than 10 hours a week. Those are LangChain's reported figures. It also names LinkedIn, Uber and Elastic.
Most teams start with one agent and a few tools, and that is the right start. These signs say it is time for more structure or a more complex framework:
Each of those maps to one of LangGraph's key features: separate nodes, tracing per step, checkpoints, interrupts and per-node configuration.
For retrieval specifically, my guide to moving to agentic RAG covers the architecture, and my analysis of whether agentic RAG is worth it covers when the extra cost pays off.
The playbook we use on client builds, drawn from more than 100 agentic RAG systems. It shows how to set one up, how to evaluate it so you know what is failing, and how to improve the answers it gives.
• How we build agentic RAG systems on real client projects
• How we evaluate them, so you know what to fix next
• How we improve results once evaluation shows the gaps
• The exact tools we use, and how they fit your existing stack
LangGraph is one of several serious agent frameworks. The axis that separates them is how explicitly you control state and flow, and what you get for durability and human review.
A few notes on the other frameworks. CrewAI pairs role-based crews of agents with Flows, which it describes as structured, event-driven workflows that manage state. Microsoft Agent Framework reached 1.0 in April 2026 and unifies Semantic Kernel's foundations with AutoGen's orchestration; the AutoGen repository is now archived and points new users to it.
The OpenAI Agents SDK keeps a small set of primitives, agents, handoffs and guardrails, plus built-in tracing and sessions. Google's ADK offers workflow agents for sequential, parallel and loop execution, and ADK 2.0 adds graph-based workflows. LlamaIndex Workflows are event-driven steps, strongest when the core of the job is to retrieve data.
Choosing between LangChain and LangGraph is a choice of level, not of vendor. Use LangChain's create_agent for a standard agent loop with tools and middleware; it runs on LangGraph underneath. Drop down to LangGraph when you need custom control flow, several agents, explicit retries or human review.
CrewAI gets a multi-agent team working faster, because you describe roles and tasks rather than a graph. LangGraph takes longer to build and gives you more control: every step, branch and retry is explicit, and the state is saved after each one. Pick CrewAI for a quick role-based prototype and LangGraph when the system must be debugged, audited and run for a long time.
Microsoft Agent Framework is the natural pick for teams already building on .NET or Azure, since it supports both .NET and Python and carries forward Semantic Kernel and AutoGen. LangGraph is a common choice for Python-first teams that want fine-grained control over each step.
The OpenAI Agents SDK is the lightest of the three. It works with OpenAI models and many other providers, and its few primitives get a simple agent shipped quickly. As a system grows into many agents with loops and review, LangGraph's explicit graph and saved state give you more to work with.
Google's ADK suits teams building on Google Cloud and Gemini. ADK 2.0 added graph-based workflows alongside its older sequential, parallel and loop workflow agents, and agents can deploy to Agent Runtime, formerly Vertex AI Agent Engine.
LlamaIndex Workflows suit systems where retrieval over documents is the main job. LangGraph is the broader choice when the hard part is the control flow between multiple agents rather than the retrieval itself.
OpenClaw and Hermes Agent are open-source agents built to be easy to set up. Each installs with one command and a setup wizard, then runs as an assistant you can message from apps like Telegram, Slack or WhatsApp. OpenClaw keeps its state and long-term memory on your own hardware. Hermes, from Nous Research, adds a learning loop that writes new skills from its own experience.
That ease comes from leaving the structure to the model. Both are highly dynamic: the agent decides what to do next on each turn. Neither has a built-in way to lay out a task as a fixed sequence of steps with checks between them. Use them for dynamic workflows, such as an assistant that should adapt as it goes, and LangGraph when a task has a shape it must follow every time.
So what is LangGraph like at scale? We built an agentic system for Interpublic Group (IPG), a Fortune 400 holding company serving around 3,000 brands, including Kenvue and General Mills.
IPG's teams needed Amazon product detail pages optimized across thousands of products and several retailers. Done by hand, the work was slow, inconsistent from analyst to analyst and expensive to scale, and every page had to respect brand guidelines and platform rules.
The system is a LangGraph implementation built from roughly fourteen ReAct agent nodes, working as a coordinated network of specialized agents. They fall into three families.
Every node runs the same loop: structure, generate, validate. When validation fails, the node returns targeted feedback and regenerates. Validation combines deterministic checks, such as character limits, prohibited terms, keyword coverage and required fields, with a qualitative review by an LLM.
Every node enforces its output against a Pydantic model with rebuild logic. HHEM-2.1 (open version on Hugging Face), Vectara's open hallucination evaluation model, screens generated content against the verified source data. LangSmith traces every node and every LLM call across each run.
A system like this has many small, separate jobs, each with its own checks and its own failure handling. A graph makes each job a node with clear inputs and outputs, and makes every retry a visible edge rather than a hidden instruction.
Tracing every node then turns a wrong recommendation into a specific step to fix. With fourteen agents, that difference decides whether a team can maintain the system at all.
The system produces recommendations, not automatic publishes. Every brief is a client-ready document that a strategist reviews before any listing changes. The results were qualitative: efficient handling of many products in parallel from one run, consistent briefs that account for each retailer, and recommendations with an audit trail behind them for enhanced decision-making.
Fourteen agents, each with its own loop and validation, is exactly the kind of system that falls apart without explicit structure. Our n8n comparison puts the lesson in one line: "The state discipline is what makes that many nodes survivable." The model matters less than knowing, at every step, what each agent saw and produced.
The same patterns, specialized agents, tool calls, validation and sources on every answer, run through our other generative AI agent work. Two examples show the kinds of systems a framework like LangGraph is specifically designed for.
Our Sales Search & Insights system ties HubSpot, Gmail and Google Docs together behind one conversational interface. Anyone on a team can ask whether someone followed up after a demo, or which deals are stuck in negotiation, and get an instant, sourced answer.
An insights pipeline also combs through CRM data for patterns nobody asked about: contacts going quiet, deals with no recent movement, support tickets drifting. It runs every day with a working memory of what came before, which is exactly the kind of long-running, stateful job explicit state is for.
Our deposition chat system uses natural language processing to answer plain-English questions across folders of legal transcripts that can run to thousands of pages. Each page is labeled with the people, organizations and topics it covers, so a question about one witness's overtime reads only the pages that matter.
Every answer cites the exact pages it drew from, and response length can be set from brief to detailed. Multi-step reading with citations is the agentic RAG pattern, and it depends on knowing exactly which pages each step used.
In our experience, teams new to LangGraph tend to make the same few mistakes. Each one is easy to avoid once you know it.
The recursion limit is a useful safety net. The Graph API docs define it as the maximum number of super-steps a graph can run in one execution, so a runaway loop stops instead of running forever.
LangGraph earns its complexity on complex workflows. On simple ones it is overhead. Skip it when:
Count the costs too. Integrations that fetch data from external services are custom code, production runs need a checkpoint database and a runtime you host or pay for, and the commercial tiers charge per seat. A common middle path is LangGraph for the agent backend behind an API, with a visual tool for triggers and integrations.
Ask four questions about the system you are planning. Does it have more than one agent or more than a few steps? Does it need to retry or loop when an output fails a check?
Does a person need to approve anything before it takes effect? Does a run last long enough that a crash would hurt? As a rule of thumb, if you answer yes to two or more, LangGraph is likely worth the engineering. If you answer no to all four, a simpler tool will serve you better.
The LangGraph library itself is free. LangGraph is open source under the MIT license, and you can run it on your own infrastructure at no cost beyond hosting.
The paid parts are LangSmith and managed hosting. LangChain's pricing page lists a free Developer seat with up to 5,000 base traces a month and a Plus plan at $39 per seat a month with up to 10,000. LangSmith Deployment, the managed hosting for stateful agents, is billed separately by compute and memory used, as of October 2026.
What is LangGraph in one line? The framework you choose when an agent system has to keep its state straight across many steps, retries and reviews. It costs more engineering than the alternatives, and it pays that back when the system is complex, long-running and must be debugged.
Frameworks are easy to demo and hard to run. If your agent system is past the demo stage, explicit state, validation and review are the work, and that is what we build.
We build multi-agent systems that have to run in production: explicit state, validation loops, tracing and human review, on LangGraph when it fits.
• A LangGraph system of about 14 agents in production for a Fortune 400 holding company
• Validation loops with deterministic checks, schemas and hallucination screening
• Tracing on every node, so failures can be found and fixed
• Recommendations people review, not unchecked automation
In artificial intelligence, the term covers two different things. In agent frameworks with graph-based architectures, like LangGraph, the graph is a control flow of steps and transitions. Among machine learning algorithms, a graph neural network is a model that learns from data shaped like a graph, with complex relationships such as social networks or molecules.
Neither is better everywhere. CrewAI is faster for role-based multi-agent prototypes; LangGraph handles complex production systems with more control, durable state and human review.
Use LangChain's create_agent for a standard agent with tools. Use LangGraph when you need custom control flow, several agents, explicit retries or human approval.
Yes. LangGraph is MIT-licensed and free to self-host. LangSmith tracing and LangSmith Deployment are the paid, optional parts.
Define a state schema, write nodes for each step, and connect them with edges, including conditional ones for retries. Then compile the graph with a checkpointer. The IBM explainer and the LangGraph docs are good starting points.