While an LLM feature is a single model call, the plain SDK is enough: assemble the prompt, send it, parse the answer. But real applications get complex fast: first find the right data, then ask the model, then call a tool, then ask again. Gluing that by hand gets tedious. LangChain is a popular framework that provides ready-made building blocks for exactly this orchestration.

What LangChain gives you

LangChain doesn't "do AI" — the model is still external. It provides building blocks and common interfaces so you can assemble full applications out of model calls without reinventing the glue each time. The key blocks:

Chains. A sequence of steps where the output of one is the input of the next: build a prompt → call the model → parse the answer. Chains let you describe the flow declaratively and reuse it. The simplest chain is "prompt template → model → output parser."

Memory. The model itself doesn't remember previous messages — each call is independent. Memory stores conversation history and mixes it into the context so the dialogue stays coherent. Different strategies decide what to keep verbatim and what to compress (so as not to overflow the context window).

Retrievers. A component that, given a query, fetches relevant chunks of data — from a vector database or another source — to put into the context. Retrievers are the basis of RAG: "find the relevant → give it to the model → get a fact-based answer."

Tools and agents. LangChain wraps tool calling and lets you assemble an agent — a model in a loop that decides for itself which tool to invoke.

Why bother if there's an SDK

A fair question: you can write all this on the provider's bare SDK. What the framework adds:

  • a single interface to different models. Switching providers (one model for another) is a one-line change instead of rewriting calls; handy for comparison and as a fallback.
  • ready-made patterns. Memory, retrievers, document splitting, output parsers — no need to rewrite what's already standardized.
  • fast prototyping. Assembling a working RAG or agent prototype from ready blocks is a matter of tens of lines.

When it gets in the way

LangChain is not a free lunch, and it's often criticized for extra abstractions. The honest caveats:

  • abstraction hides what's happening. When something breaks, you have to dig through framework layers to see which prompt actually went to the model. For debugging that's a minus.
  • overkill for the simple. If the feature is one model call, the framework only adds a dependency and complexity. The bare SDK is simpler here.
  • it changes fast. The ecosystem is young, the API evolves; code can go stale between versions.

Practical rule: one or two calls — use the SDK; a complex flow of search, memory, tools and branching — the framework saves time. And even with a framework it pays to understand what it does under the hood — otherwise debugging becomes guesswork. There are alternatives too (LlamaIndex, your own thin layer) — LangChain isn't the only one, just the best known.

Where it applies

LangChain (or an equivalent) usually shows up when an LLM feature outgrows a single call: a chatbot with memory and access to a knowledge base, an assistant that searches documents and calls external services, a pipeline that parses and enriches data. It glues the model, data and tools into one flow.

In short

  • LangChain is an orchestration framework: it gives ready blocks to assemble LLM applications out of model calls, search and tools.
  • Key blocks: chains (a sequence of steps), memory (dialogue history), retrievers (fetch data for RAG), tools and agents.
  • Pros — a single interface to models, ready patterns, fast prototyping. Cons — extra abstractions, harder debugging, a fast-changing API.
  • Rule: one or two calls — the bare SDK; a complex flow — the framework. Either way, understand what it does under the hood.

Next — RAG and embeddings: how to give the model your data so it answers from facts instead of making things up.