In short
Swapping OpenAI for Claude, adding a parser, plugging in a retriever: LangChain gives you ready parts so you are not rewriting the same glue code in every project.
A widely-used framework for chaining LLM calls, tools, memory and retrieval into structured applications — helpful for prototyping though often criticized for abstraction overhead at scale.

Think of it like this
A thali with standard katoris
A thali has fixed katoris: dal goes here, sabzi there, rice in the middle. Change the dal and the thali still works. LangChain gives every piece (prompt, model, parser, retriever) the same shape, so you can swap one without touching the rest.
Watch it happen
One chain.invoke() call
1/4{"topic": "recursion"} fills the template and becomes a list of chat messages.
The big ideas
What you need to know
Runnables and the pipe
Prompts, models and parsers are all Runnables. The | operator joins them into a chain, read left to right.
Swap providers easily
init_chat_model lets you change provider with one string. Your prompt and parser code stays the same.
Integrations for everything
Loaders, vector stores and tools for hundreds of services live in separate langchain-* packages you install as needed.
LangGraph for agents
For loops, branches and state, the LangChain team points you to LangGraph, which builds agents as graphs of steps.
See it in code
Walk through the code
1from langchain.chat_models import init_chat_model2from langchain_core.prompts import ChatPromptTemplate3from langchain_core.output_parsers import StrOutputParser4 5prompt = ChatPromptTemplate.from_template(6 "Explain {topic} to a first-year student in 3 lines."7)8model = init_chat_model("gpt-5-mini", model_provider="openai")9chain = prompt | model | StrOutputParser()10 11print(chain.invoke({"topic": "recursion"}))1/4A template with a {topic} slot. Every call fills it with a fresh value.
A three-part chain. Needs langchain, langchain-openai and an OPENAI_API_KEY. Change the model string to try another provider.
Save yourself the pain
Common mistakes
Oops
Copying a 2023 LangChain tutorial with LLMChain and old imports.
Do this instead
The API has changed a lot. Use the current docs, langchain_core imports and the pipe syntax.
Oops
Adding LangChain to a project that makes one API call.
Do this instead
For one call, the provider SDK is simpler. Bring in LangChain when you need swapping, retrieval or many integrations.
Your mission
Build and swap a chain
Quick check
In prompt | model | StrOutputParser(), what does the parser receive?
Go deeper
- 1Build a simple chain and a simple agent using LangChain's core abstractions.
- 2Learn LangChain's building blocks: chains, tools, memory, retrievers.
- 3Understand when going 'framework-free' with raw API calls is actually simpler for your use case.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.