16 of 174 subtitles documented + 1 independent supplementary unit(s) · Writing progress, not your learning progress · Videos not visually reviewed
What is LangChain, and why was it created?
Prerequisite: models, tokens, context, and application memory.
Start with the problem: a model versus an application
Suppose you ask a model how much annual leave your company's policy allows. Unless the policy is provided or an appropriate access tool is available, the model has no reliable access to that private document. A fluent answer does not establish access to evidence.
Even if you manually paste the policy into a message, a product needs more work: reading files, selecting relevant passages, constructing instructions, calling the model, checking output, and making failures traceable. A multi-turn conversation also needs selected history supplied again as input.
The problem is therefore not only text generation. It also includes coordinating the components around the model. This distinction is the starting point for understanding LangChain.
History: why did this tool emerge?
According to the LangChain team's own account, the first Python package was released on October 24, 2022. Its early motivation was composing language models with external data and computation. Developers repeatedly connected models, documents, and APIs; a library could make that shared integration work reusable. Historical source
Two research directions provide useful context: the 2020 RAG paper combined retrieval with answer generation, and the 2022 ReAct paper investigated combining reasoning and action. These are conceptual antecedents; this does not attribute every LangChain component to a single paper. RAG, ReAct
Later, attention shifted from rapid prototypes to controlled, dependable applications. An official 2024 retrospective explains how demand for tracing, evaluation, and greater control over agent architectures shaped the roles of LangSmith and LangGraph. Retrospective
What kind of thing is LangChain?
LangChain is a software framework for building language-model applications. It is not itself a language model, and using it does not automatically train a model. It provides composable building blocks for models, inputs, data, and tools. This is also the central definition in lecture 006.
An abstraction is a shared contract that hides some implementation differences behind an interface. Think of different printers accepting the instruction to print: their internals differ, but a simple task should not require a complete rewrite. This analogy is supplementary teaching material.
Which problem does each component address?
- Chat model: an interface to a model. It can simplify changing providers without making their features, costs, or behavior identical.
- Prompt template: combines fixed instructions with variable data, such as a question and a document passage. A template alone guarantees neither security nor correct answers.
- Document loader: reads a source into processable text and metadata. Reading a file and selecting the relevant passage are different responsibilities.
- Retriever: returns information relevant to a query. Retrieval is a separate role from loading; this distinction supplements the lecture.
- Tool: an operation the application permits, such as search or calculation. Typically, the model generates a tool request and application code executes it.
This list describes concepts. It does not promise that all relevant classes come from a single package or import path. Package organization changes across versions.
A visual model: a policy assistant
In this teaching diagram, the document has already been loaded. The application supplies relevant text together with the question; the model is not directly connected to a private file. The optional tool path does not mean every question requires a tool. This is an original diagram, not a reconstruction of an instructor slide.
Invented example: a policy says full-time employees receive 20 days of annual leave. That passage supports an answer about full-time employees. It does not establish the allowance for part-time contracts. The appropriate response identifies missing evidence; similar-looking questions do not justify automatic generalization.
Distinguish chains, RAG, and agents
A chain or predetermined workflow follows steps chosen by the programmer, such as building a prompt, calling a model, and processing output. “Chain” here refers to our simple example, not a restriction on all runnables: runnables can also implement branching or agent loops. This is not a recommendation to use an older class with that name.
Retrieval-augmented generation (RAG) retrieves relevant information before generating an answer using that evidence. This ordinarily does not change the model's weights. Answer quality still depends on retrieval quality and how evidence is used.
An agent gives the model a role in choosing the next step or tool within application-defined boundaries. It might search, inspect the result, and decide whether another search is needed. An agent can use RAG; having retrieval alone does not make a system an agent.
Where do LangGraph and LangSmith fit?
Official documentation checked on 2026-10-16 presents LangChain as the higher-level agent-building layer and LangGraph as infrastructure for execution flow and state. LangSmith supports tracing and evaluation. LangGraph can also be used independently of LangChain. LangChain, LangGraph
State is the data carried through an execution, such as messages or tool results. Tracing reveals calls and failure locations. Evaluation measures whether results meet desired criteria; seeing an execution trace does not itself prove correctness.
When is a framework worthwhile?
Our design guidance: a provider's SDK may suffice for one straightforward model request. When repeated integration work and connections accumulate, a framework can reduce shared code. It also adds an abstraction layer and version dependencies. Choose according to the application's complexity rather than the tool's popularity.
Exercises: design it yourself
- Does loading a PDF into a document loader mean the model has learned it? Explain.
- Which component should select the relevant policy passage?
- How does a calculator always executed by the application differ from a tool selected by an agent when needed?
- When changing models, is changing an import necessarily enough? Name two things to recheck.
Answers — reveal after attempting
- No. Loading prepares data for the application. Model training and supplying data as input are different processes.
- A retriever. The loader reads the source. Even manual selection is a separate selection responsibility.
- The first is a fixed workflow step; in the second, the model participates in choosing the step. Execution and tool constraints still belong to the application.
- Not necessarily. Recheck relevant capabilities such as tool use and structured output, answer quality, message formats, costs, and provider limits.
Provenance and next step
Course basis: lecture 006 subtitles, from 00:00 to approximately 06:00, covering the framework, models, prompt templates, loaders, tools, and ecosystem. These timestamps describe the whole lecture, not claim-level citations. History, analogy, the policy example, conceptual distinctions, and exercises are supplementary teaching material; official sources are linked beside the relevant claims. This stage did not include watching the video or executing LangChain code.
Continue to project setup, lectures 007–008, then the first chain, lectures 009–010. Sources checked: 2026-10-16.