A field guide for product managers · about 20 minutes
LangChain, LangGraph and Langfuse, explained with one agent
Engineers often mention these three tools in the same breath. They do three different jobs. We'll use one example throughout: a research assistant that takes a question, searches the web, reads the results and writes a short report.
Words with a dotted underline, like , are technical terms. Tap one for a plain-English definition.
1 · The big picture
Three tools, three jobs
Think of building an as running a restaurant kitchen. You need ingredients and utensils, a recipe that says what to do and when, and a camera that records how each dish was actually made.
BuildLangChain
The ingredients and utensils
Ready-made parts for talking to an , writing prompts and connecting tools such as web search.
OrchestrateLangGraph
The recipe card, with decisions
"If the sauce is too thin, reduce it again." "Chef tastes before it goes out." It sets the order of steps, the loops and the checks.
ObserveLangfuse
The kitchen camera and the receipts
A record of every step: what went in, what came out, how long it took and what it cost. You use it to find out why a dish went wrong.
LangGraph and LangChain live inside your app's code. Langfuse sits outside it as its own service. Your app sends it a record of each run, and can fetch the latest prompt versions from it.
PM takeaway
LangChain builds the parts, LangGraph runs them in the right order, and Langfuse shows you what actually happened.
Interactive demo
Click through one run of the research assistant
Each click runs one step of the graph. Watch the active step light up, the state change, and the trace grow on the right. Then pick a failure to see how the graph retries or changes route.
Simulation.No real AI model, search engine, LangChain, LangGraph or Langfuse is running here. The steps, results, timings, token counts and prices are realistic scripted examples, and the trace panel is a simplified look-alike, not the real Langfuse screen.
Question:
Keys: N next · P play/pause
Graph LangGraph · which step runs, and where it goes next
running nowalready ranerrorwaiting for a person
State the shared notebook every step reads and writes
Trace Langfuse-style · simulated
0.0 slatency
0tokens
$0.0000cost
0observations
2 · LangChain · build
LangChain: a box of building blocks for LLM apps
LangChain is an framework, available for Python and JavaScript. It gives developers standard parts for common LLM tasks, so they don't have to build each one from scratch.
The main parts, in our research assistant
Models
One standard way to call many LLM providers. Switching providers can be a one-line change instead of a rewrite.
Ours: a large model writes the report, a small, cheap one grades search results.
Prompts
A is a reusable prompt with blanks to fill in, such as {question} and {notes}.
Ours: "Write a 150-word report answering {question} using only these notes: {notes}"
Tools
Wrappers that let the model ask for actions, like searching. LangChain has ready-made for hundreds of services.
Ours: web_search and fetch_page.
Memory
Ways to keep the conversation and earlier results so later steps can use them. In recent versions, this is mostly handled by LangGraph's saved state.
Ours: the question, search results and notes carried from step to step.
Chains
A links parts in a fixed line: prompt, then model, then clean up the output.
Ours: the "write the report" step is a small chain.
Also included
Document loaders, text splitters, and for searching your own documents, plus parsers that turn model output into structured data.
What it looks like in code
# Simplified. The "|" symbol means "then".
model = init_chat_model("provider:large-model") # change this line to switch provider
prompt = ChatPromptTemplate.from_template(
"Write a 150-word report answering {question} using only these notes: {notes}")
write_report = prompt | model | StrOutputParser()
report = write_report.invoke({"question": q, "notes": notes})
Four lines replace a lot of hand-written code for building the request, calling the provider's and reading the reply.
Makes easier
Swapping between model providers
Connecting common tools, databases and document stores with ready-made integrations
Getting a prototype working in days
Hiring: many engineers already know it
Can feel heavy
Many layers of . When something breaks, the error can be hard to trace back.
Overkill for one or two model calls, where the provider's own SDK is simpler
Fast-moving: past versions changed often, so upgrades can take work
LangChain speeds up building the parts. Ask whether you need the speed or whether the parts are simple enough to write directly.
3 · LangGraph · orchestrate
LangGraph: an agent drawn as a map of steps
LangGraph is an open-source library from the same company as LangChain. You describe your agent as a : boxes for steps and arrows for what can come next. It can be used with or without LangChain.
Why a straight-line chain isn't enough
A chain only moves forward. A graph can loop back, take different routes based on what it found, and stop to ask a person. Most production agents need at least one of these.
Is a graph still an agent? In module 1's terms, a developer draws this map, and the model decides which arrow to take and what to search. That's level 4 on module 1's spectrum: an agent with fences. A fully open agent loop is also a graph, just a tiny one (model → tools → model), and LangChain's create_agent builds exactly that.
The key ideas
Nodes
A is one step, such as search or write. Inside, it can use LangChain parts or any other code.
Edges and branches
An is an arrow to the next step. A picks the route based on results: good results go to read, poor ones to rewrite_query.
State
The is a shared notebook passed between steps: the question, results, notes and draft. Every node reads it and updates it.
Loops and retries
Arrows can point backwards to try again. A re-runs a step automatically when it errors, for example a search that times out.
Checkpoints
A saves the state after every step. If the server crashes, the run picks up where it stopped instead of starting over.
Human approval
An pauses the run so a person can approve, edit or reject. It can wait minutes or days, then resume.
The research assistant as a graph, in code
# Simplified. This is the same graph you clicked through in the demo.
graph = StateGraph(ResearchState) # state: question, query, results, notes, draft…
graph.add_node("plan", plan)
graph.add_node("search", search, retry_policy=RetryPolicy(max_attempts=3))
graph.add_node("grade", grade)
graph.add_node("rewrite_query", rewrite_query)
graph.add_node("human_review", human_review) # calls interrupt() to wait for a person# …read, write, no_sources
graph.add_edge(START, "plan")
graph.add_edge("plan", "search")
graph.add_edge("search", "grade")
graph.add_conditional_edges("grade", route_after_grade) # good → read · poor → rewrite_query · 2 tries → no_sources
graph.add_edge("rewrite_query", "search") # the loop
app = graph.compile(checkpointer=saver) # checkpoints let a paused run resume later
When to choose LangGraph over LangChain alone
Your flow needs…
LangChain alone
Add LangGraph
A fixed sequence (prompt → model → answer)
Enough
Not needed
Different routes depending on results
Possible, but gets messy
Built in
Loops ("try again until good enough")
Hand-written
Built in, with limits
Pausing for human approval
Hand-written
Built in (interrupts)
Surviving crashes and long waits
Hand-written
Built in (checkpoints)
Several agents handing work to each other
Hard
Designed for it
In recent versions, LangChain's own "create an agent" helper runs on LangGraph underneath. Teams often start there and drop down to a custom graph when they need more control.
Check your understanding · LangGraph
The search returns junk results. In the stack described here, which part decides to rewrite the query and search again?
If your agent needs to loop, branch, retry or wait for a person, it needs a graph. LangGraph is one well-used way to build one.
4 · Langfuse · observe
Langfuse: a flight recorder for your LLM app
Langfuse is an open-source platform for of LLM apps. It has three main jobs: tracing, prompt management and evaluation. Your team can use Langfuse's cloud version or it.
A separate project. Langfuse is made by a different company from LangChain and LangGraph. It works with them through a ready-made connector, and it works just as well without them: with plain provider SDKs, other frameworks, or anything that speaks . LangChain's own product for this job is called LangSmith.
What a trace looks like
A is the full record of one run. Inside it are nested pieces called observations.
TRACE research-assistant 8.4 s · $0.0158
SPAN plan 1.6 s
GENERATION chat-large 780 tok · $0.0044
SPAN search 0.9 s
TOOL web_search 0.9 s
SPAN write 3.0 s
GENERATION chat-large 2,200 tok · $0.0102
SCORE citations_valid = 1.0
TRACE One run
Everything that happened for one question, with total time and cost.
SPAN One step
A is a timed piece of work, such as one node of the graph.
GENERATION One LLM call
A shows the exact prompt, the reply, the model, the and the cost.
SCORE A quality grade
Added by code checks, an or user feedback such as a thumbs-down.
How it helps you debug
Cost
"Why did costs double this week?"
Filter traces by cost and see which step and which model spends the most. For example, a loop that searched 5 times instead of once.
Latency
"Why is it slow?"
The timeline bars show where time goes. is often one slow tool, or steps that could run at the same time but don't.
Wrong answers
"Why did it say that?"
Open the trace for a bad report. Check what the search returned, what the model was given, and the exact step where it went wrong.
Prompt management and evaluation
Prompt management
Prompts are stored and versioned in Langfuse rather than in the code. A PM or engineer can change the report prompt, label it "production" and roll it back if it's worse, without a code release. Each trace shows which prompt version produced it.
Evaluation
Score traces automatically (citation check, LLM-as-judge), collect user feedback, and run a saved set of test questions, called a dataset, against a new prompt or model before it ships. An turns "it seems better" into a number.
# Simplified. With LangChain/LangGraph: pass one handler.
handler = CallbackHandler()
app.invoke({"question": q}, config={"callbacks": [handler]})
# Without them: mark your own functions to be traced.
@observe()
def research(question): ...
A handler is a listener that LangChain notifies at every step, so Langfuse can record it.
Check your understanding · Langfuse
A client says Tuesday's report cited a dodgy source. What do you need to find out why, quickly?
Without tracing you're guessing about quality, cost and speed. Langfuse gives you the evidence, whichever framework you use.
5 · How they work together
The same research assistant, before and after
"Before" is a plain script written by a good engineer. "After" splits the work between the three tools. Everything on the right can be built by hand. The real question is whether you want to build and maintain it yourself.
Situation
Before: a plain script, done well
After: all three tools
Switch to another model provider
Write and keep up your own small wrapper around each provider's SDK
Change one line LangChain
Search returns junk
Add a grading call, an if-statement and a loop counter
Grade step and a conditional edge, drawn on the map LangGraph
Search tool times out
Write a retry with back-off around the call
A retry policy on the step LangGraph
Report needs sign-off
Save progress to a database and write your own resume logic
Interrupt and checkpoint, resume any time LangGraph
"Why was Tuesday's report wrong?"
Log every prompt, reply and tool call yourself, then build a way to search the logs
Open that trace and see every step Langfuse
"What does one report cost?"
Record token counts and keep a price table up to date
Cost per run, per step, per model Langfuse
Improve the report prompt
Code change and release, or build your own prompt store
New prompt version, compare with an eval, roll back in a click Langfuse
LangChain does
The model calls in plan, grade and write, the prompt templates, and the web_search and fetch_page tools.
LangGraph does
The order of steps, the poor-results loop, the retry on timeout, the human approval pause and the saved state.
Langfuse does
Records every run as a trace, adds scores, stores the prompts and powers the cost and quality dashboards.
You don't have to use all three. Many teams use LangGraph without LangChain's extras, or call providers directly and add only Langfuse. Each piece can be swapped for an alternative.
PM takeaway
The "after" version isn't smarter. It saves you building and maintaining the plumbing that production needs. If you only need one or two rows of this table, plain code may still be the better choice.
6 · Decision guide
Which ones does your team need?
Tool
Use it when…
Skip it when…
LangChain
You want to try several model providers, need ready-made integrations (search, databases, documents), or want a fast prototype.
It's one or two model calls, the team prefers the provider's own SDK, or you want the fewest dependencies possible.
LangGraph
Your agent loops, branches, retries, waits for human approval, runs for a long time, or involves several agents.
The flow is a straight line, or a simpler agent toolkit already covers what you need.
Langfuse
Anything LLM-based going to real users: you need cost per feature, debugging, prompt versions or evals. Self-hosting helps when data must stay in your own systems.
It's a throwaway prototype, or the company already uses another LLM tracing tool, such as LangSmith.
The other options your engineers may suggest
These three tools are popular, not the only choice. Each row below can replace one of them.
Instead of…
Option
Best when…
Trade-off
LangChain
The provider's own SDK
One provider, a simple flow, and you want the newest features on day one
You write the glue. Switching providers means rewriting calls.
LangChain
LlamaIndex
The product is mostly about your own documents: parsing, indexing and RAG
Overlaps with LangChain. Different building blocks to learn.
LangGraph
Provider agent SDKs: OpenAI Agents SDK, Claude Agent SDK, Google ADK
You want a lighter agent loop with tools, handoffs and guardrails built in
Often tuned to one provider. Less control over the exact flow.
LangGraph
Other agent frameworks, such as CrewAI or Pydantic AI
The team prefers their style: role-based crews, or strictly typed Python
Smaller ecosystems. Check how they handle checkpoints and approvals.
LangGraph
A durable workflow engine, such as Temporal
Long-running jobs where retries and resume must be rock solid, and you already run one
Not built for LLMs. You write the agent logic yourself.
Langfuse
LangSmith
The team is all-in on LangChain and LangGraph and wants one vendor
Commercial. Self-hosting only on enterprise plans.
Langfuse
Arize Phoenix, Braintrust, Helicone, W&B Weave
You want a different balance of open source, evals and set-up effort
Each has different strengths. Compare on your own traces.
Langfuse
Your existing monitoring tool, such as Datadog
The company already runs it and wants one place for all monitoring
Usually lighter on prompt management and evals.
This space changes quickly. Treat these as examples, not a ranking, and check each project's current docs and pricing.
What each choice really costs
"Open source" means no licence fee, not no cost. Ask for the total: licences, hosting, the people to run it, and model usage.
Tool
Licence
What you pay for
LangChain
Open source (MIT)
Engineering time, and keeping versions and dependencies up to date
LangGraph
Open source (MIT)
Your own servers and checkpoint database, or a paid managed service from LangChain Inc.
Langfuse
Open source (MIT core; a few enterprise features need a paid key)
A Langfuse Cloud plan, or the servers and people to self-host it: a database, an analytics store, a cache and file storage
LangSmith
Commercial
Seats and usage-based plans
Model provider
Commercial
Tokens. Usually the biggest bill, whichever framework you pick.
Questions to ask your engineering team before choosing a stack
Do we need it?
What's the simplest version that would work? Do we need a framework at all?
Which parts of our flow need loops, retries or human approval?
How hard would it be to swap one of these tools out later?
Will it hold up in production?
If a run crashes halfway, can it resume? Where is the state saved?
What limits stop a loop from running forever, and what does a run cost at most?
Which versions are we on, and who owns upgrades?
Can we see what it does?
Where do traces go, and who can see them?
Do traces contain personal or client data? Should we hide it or self-host?
How will we spot cost spikes and quality drops? Who gets alerted?
Can we improve it safely?
How do we change a prompt: code release or prompt management? Who can do it?
What's our eval set, and does it run on every change?
How do user complaints turn into new test cases?
Check your understanding · Decision guide
A new feature is one prompt and one model call, going to real users next month. What does it need from this stack?
PM takeaway
Choose the smallest stack that handles your flow's real needs, and plan tracing from the first day.
Keep this
One-page cheat sheet
LangChainBuilding blocks: models, prompts, tools, retrievers. The ingredients and utensils.
LangGraphThe flow as a graph: state, branches, loops, retries, checkpoints, human approval. The recipe card.
LangfuseTraces, prompt versions, evals, cost and latency. The camera and receipts.
Who makes what
LangChain and LangGraph: open source, both from LangChain Inc. They work together, and LangGraph also works on its own.
Langfuse: open source, from a separate company. Cloud or self-hosted. Works with any framework.
LangSmith: LangChain's own tracing and evaluation product, an alternative to Langfuse.
Alternatives: provider SDKs and agent SDKs, LlamaIndex, CrewAI, Temporal, Phoenix and more. See the decision guide.
Words you'll hear
Chain: fixed sequence of steps
Node / edge: a step / an arrow between steps
State: the shared notebook between steps
Checkpoint: saved state, so runs can resume
Interrupt: pause for a person
Trace / span / generation: a run / a step / an LLM call
Score / eval: a quality grade / a test across many examples
PM takeaways
Build, orchestrate, observe: three different jobs.
LangChain speeds up building, but can be heavy for simple apps.
Loops, branches, retries or approvals mean you need a graph.
Tracing is how you find out about quality, cost and speed.
The "after" version is sturdier, not smarter.
Choose the smallest stack, and trace from the first day.
Numbers to ask for
Cost per run, and the most one run can cost
p95 latency, and the slowest step
Retries and loops per run
Eval pass rate, and how it changed after the last release
Human approval rate and rejection rate
Glossary
Learn from others
3 common mistakes teams make with these tools
1
Adopting the whole stack on day one
What it looks like
A feature that is really one prompt and one API call gets wrapped in chains, graphs and agents. It becomes harder to debug and slower to change than plain code.
Fix
Start with the simplest version. Add LangChain or LangGraph when a real need appears, such as a second provider, a loop or an approval step.
2
Graphs without limits or checkpoints
What it looks like
A "try again" loop has no maximum, so a bad day for the search tool burns through budget. Runs waiting for approval are lost when the server restarts.
Fix
Cap every loop and retry (our graph gives up after 2 rewrites). Turn on a checkpointer, and test the failure paths, not just the happy path.
3
Treating tracing as a checkbox
What it looks like
Langfuse is switched on, but no one reviews traces, sets cost alerts or adds scores. Meanwhile, traces quietly store customers' personal data.
Fix
Agree on who reviews traces each week. Set alerts on cost and errors, score quality automatically, and hide sensitive fields before they're sent.