LangChain vs LangGraph vs LangSmith: Which One You Need
You start reading about agent frameworks and three names show up at once: LangChain, LangGraph and LangSmith. All three belong to one ecosystem, and the names differ by a single word. The jobs differ more.
The codebasics channel explains the split in a ten-minute video, LangChain vs LangGraph vs LangSmith. The video follows one example, a chatbot for an online clothing store, and grows the example from a simple question to a multi-step task. This post follows the same path.
Start with RAG
A model such as GPT or Claude learned from a huge volume of internet data. Ask a general question and you get an answer. Ask your store’s chatbot “What is the refund policy on t-shirts?” and the model has nothing to go on. Your policy documents are private. The model never saw them.
Retrieval augmented generation (RAG) fixes this. You feed your policy documents into a pipeline, and the model answers from them. The steps:
- Load the documents.
- Split them into chunks to fit the model’s context window.
- Store the chunks in a vector database for semantic search.
- Retrieve the relevant chunks and call the LLM with them.
You can write all of this in plain Python. LangChain gives you ready-made classes for each step instead, such as a text loader for step one.
Workflows and agents
The video borrows a split from Anthropic’s guide Building effective agents. LLM applications fall into two groups: workflows and agents.
A workflow is ordinary software with an LLM as one component. Your code follows a predefined path. You load data, preprocess the data, call the LLM to extract or summarize something, run another step, and call a second LLM if you need one.
The LLM makes no autonomous decisions here. You give the model a fixed task, such as “extract this field from the text”, and your code handles the rest. The video calls this kind of pipeline a chain. LangChain exists to make chains easy to build.
When one answer is not enough
Now a customer writes: “I want to exchange my t-shirt for a different item.” Your chatbot can’t answer in one shot. The bot asks for the order ID. The customer sends the order ID. The bot asks which item they want instead. The customer sends a SKU.
Behind the conversation, the bot has four jobs:
- Check the refund policy for the returned item. The bot reads your policy documents.
- Check the order details. The bot queries your database for eligibility and price.
- Check whether the new item is in stock. The bot calls a microservice or an API.
- Order the new item and print a shipping label for the old one. The bot uses other software for this.
The LLM takes part in some or all of these steps. The documents, the database and the APIs are the agent’s tools. The bot plans toward a goal, breaks the goal into subtasks and runs them one by one.
Steps fail. Say the new item is out of stock in your colour. The bot retries, calls a different API or tries another colour. The video compares this loop to how you debug code: you run the code, see an error, fix the error and run again. An agentic chatbot has enough autonomy to work through this loop on its own.
LangGraph: agents as graphs
A common design for agentic apps is a stateful workflow drawn as a graph. You start with an LLM call. The LLM decides the next step: step A, step B, or a call to a second LLM. The second LLM decides on its own too. The second model runs step C, D or E, or hands control back to the first LLM. You write the prompts, but the model picks the path. The example graph in the video has four possible paths.
LangGraph is a framework for orchestrating multi-step, stateful workflows with a graph structure. The demo in the video is small. A dummy Python tool returns the latest price of a stock such as Microsoft or Apple. The graph has a start node, a chatbot node and the stock price function as a tool. You type “I want to buy 20 Amazon stocks”. The agent calls the tool, gets the price and returns the total for the whole transaction.
LangChain vs LangGraph
The video sums up the difference in a short comparison:
| LangChain | LangGraph | |
|---|---|---|
| Purpose | Toolkit for LLM apps: chains, tools, agents | Framework used mainly for agents |
| Flow | Linear and reactive: input in, response out | Graph based, with loops and retries |
| State | Partially stateful | State lives in the graph, plus memory |
| Typical use | Simple chatbots, RAG | Multi-step workflows, complex agents |
The rule from the video: write simple linear workflows with LangChain. Build complex agents with LangGraph.
LangSmith: see what your app does
LangSmith is the odd one out. You don’t build an app with LangSmith. You watch your app with LangSmith. The video describes LangSmith as a debugging and observability platform, while LangChain and LangGraph are both open source. LangSmith covers debugging, a playground, prompt management, monitoring and evaluation.
Once your agent runs in production, you want answers to plain questions. Does the agent perform well? Where does the agent fail? How much do you spend on tokens? The video stresses the last one. You don’t want to find out about runaway token costs from your invoice.
The demo shows a trace for one request. You see each call in order: first the vector database, then ChatGPT. For each call you get the input, the output, the token count (390 in the demo) and the latency. The video points out tracing is one feature among several.
Which one you need
- Your app answers questions from your own documents. Start with LangChain and a RAG chain.
- Your app runs a fixed sequence of steps with an LLM in one or two of them. Use LangChain.
- Your app has to plan, branch, retry and keep state across turns. Use LangGraph.
- Your app runs in production, or you can’t explain why your agent did something. Add LangSmith next to whichever framework you use.
Pick the smallest tool for the job. A RAG bot doesn’t need a graph. Start with a chain, and move to a graph once your flow needs loops or branches.
For a working system built from many specialized agents, read how the Claude SEO plugin runs up to 17 agents in parallel. For an agent with a review step built into the loop, see Hallmark.
Watch the full video on the codebasics channel. The description links to longer crash courses on LangChain and LangGraph.