Roger Mendoza

LangChain and LangGraph: where I actually meet them

I rarely start a project with LangChain — but I keep meeting it inside the tools I use. What LangChain and LangGraph each do, and when the abstraction helps versus when plain code is clearer.

Repos: langchain-ai/langchain · MIT · and LangGraph, its sibling for agent workflows

Honest confession: I don't usually begin a project with import langchain. But I keep running into it, because a lot of the open-source AI tooling I use is built on top of it. TradingAgents, for example, is built on LangGraph. So it's worth knowing what each piece is for.

LangChain vs LangGraph

  • LangChain is a framework for building LLM applications and agents: model wrappers, prompt templates, tool calling, retrieval, document loaders and text splitters, all with a common interface across providers.
  • LangGraph is the team's framework for controllable agent workflows — agents as graphs of steps with explicit state, branches and loops.

The simplest way to remember it: LangChain gives you the parts; LangGraph gives you the wiring diagram.

Where LangChain helps

  • Document loading and splitting. Turning PDFs, web pages and markdown into retrievable chunks is tedious, and LangChain's loaders and splitters handle the tedium.
  • Swapping providers. A common interface makes it easy to try a different model without rewriting call sites — although a gateway like LiteLLM or OpenRouter can do that too.
  • Prototyping retrieval. Getting a working retrieval-augmented prototype in an afternoon is genuinely easy.

Where plain code is clearer

For small, focused jobs — call a model, validate a JSON response, write to a database — I usually skip the framework. The direct API call plus a Pydantic model is fewer moving parts and easier to debug. Most of my production automations look like that.

Why LangGraph is the interesting one

Agent systems fail in loops and hand-offs. LangGraph makes those explicit: the state is a typed object, each node is a function, and edges decide what runs next. That's why multi-agent projects like TradingAgents build on it — you can see and test the flow instead of hoping an agent remembers its instructions.

My rule of thumb

Use the framework when it removes real work — loaders, retrieval, multi-step graphs. Skip it when it only adds layers between you and a single API call. Either way, put validation at every boundary; no framework does that for you.

Some links in these notes are affiliate links. If you buy through one, I may earn a commission at no extra cost to you. I only link to tools I use or would recommend.