By lesson 3 you can write an agent loop by hand. So why does every job description mention LangChain? For the same reason backend jobs mention frameworks rather than raw sockets: nobody wants to rewrite prompt templating, output parsing, retries, document loaders and forty vector-store integrations on every project. This lesson covers what LangChain actually gives you, the vocabulary interviews expect, and the honest criticism you should be able to state — because being able to critique your tools is what makes you sound senior.
What LangChain is — and what it isn't
LangChain is a toolkit: standard building blocks for prompts, model calls, tools, retrieval, memory and output parsing, plus hundreds of integrations (model providers, vector stores, document loaders). It is not a model, not a hosting platform, and not a source of intelligence. Swapping a raw API call for LangChain changes your code's structure, never your answers' quality.
The value is real when you're gluing many pieces together — loaders, splitters, stores, models — and want them behind one interface you can swap. The cost is an abstraction layer between you and the prompt actually being sent, which matters more than people expect.
Chains and LCEL — composition with a pipe
A chain is a composed sequence where each step's output feeds the next. LCEL (LangChain Expression Language) writes that with the pipe operator:
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
prompt = ChatPromptTemplate.from_template(
"Summarize this support ticket in one line:\n\n{ticket}"
)
chain = prompt | model | StrOutputParser()
print(chain.invoke({"ticket": "mixer sparking after 2 days, want replacement"}))Result
Customer reports a new mixer sparking after two days and requests a replacement.
Composing with | also gives you .stream(), .batch() and async versions for free.
Note carefully what this is: a chain is a fixed sequence — a workflow, not an agent. The model makes no decision about what happens next. Getting this distinction right in an interview immediately signals you understand lesson 1.
Output parsers — text into objects
Everything downstream of an LLM is ordinary code, and code needs structure. Parsers convert the model's text into typed Python objects, validating as they go:
from pydantic import BaseModel
from langchain_core.output_parsers import PydanticOutputParser
class Ticket(BaseModel):
product: str
issue: str
urgency: str # low | medium | high
parser = PydanticOutputParser(pydantic_object=Ticket)
chain = prompt | model | parser
ticket = chain.invoke({"text": "my new mixer is sparking!"})
print(ticket.urgency)Result
high
The win is that a malformed response becomes a caught, retryable error at the boundary — instead of a crash three functions later when something expected a dict and got an apology paragraph.
Tools and agents in LangChain
Tools are ordinary Python functions with a description — the same idea as lesson 2, wrapped in a decorator:
from langchain_core.tools import tool
@tool
def get_order_status(order_id: str) -> str:
"""Get the live delivery status of a customer order by its numeric id.
Use only for questions about where an order is."""
return orders.status(order_id)Notice where the description lives: the docstring becomes the tool description the model reads, and the type hints become the schema. Convenient — and a trap, because a lazily-written docstring is now a lazily-written prompt. For agent execution itself, modern LangChain points you at LangGraph, which is the next lesson.
Memory components — bookkeeping over statelessness
LLM APIs are stateless (GenAI lesson 8), so "memory" means storing history and re-injecting it. LangChain standardizes the variants, which trade fidelity for tokens: keep everything (buffer), keep the last N turns (window), or keep a rolling summary. None of them extend what the model can see per call — a point worth stating explicitly, because the word "memory" misleads a lot of candidates.
LangSmith — because agents can't be debugged from the output
A multi-step run that ends badly tells you almost nothing from its final message. LangSmith (and alternatives like Langfuse and Arize Phoenix) records the full trace: every prompt, tool call, argument, result, latency and token count, plus dataset-based evaluation.
Tracing is not optional for agents. The bug is a malformed argument at step 3, or a tool that returned an empty list — both invisible in the final answer. Lesson 9 is entirely about this.
Wait — should I use a framework at all?
The honest criticism, which you should be able to state in an interview: abstractions hide the prompt. When something goes wrong, you need to see the exact text sent to the model — and layers of helpers can make that surprisingly hard. There's also churn (agent frameworks move fast) and lock-in risk.
The mature position: use frameworks for plumbing and integrations, but always be able to see and explain the final prompt, and keep your tool implementations and prompts as plain functions and strings so leaving is cheap. For a simple agent — a few tools, a bounded loop — the raw loop from lesson 3 is genuinely fine, and writing it once teaches you what the framework is doing.
Selection-round radar: service-company interviews ask "have you used LangChain?" and expect vocabulary — chains, LCEL, tools, memory, retrievers. Product companies more often ask "what are its downsides?". Have both answers ready: what it gives you, and why you'd still write the loop yourself for something small.
Common mistakes
- Calling a chain an agent — chains are fixed sequences with no runtime decisions.
- Writing a one-line docstring on a tool and wondering why the model picks it wrongly.
- Reaching for the framework before understanding the raw API call.
- Believing memory components extend the context window.
- Running agents in production without tracing.
- Coupling business logic tightly to framework abstractions, making migration expensive.
Quick recap
| Concept | One-liner |
|---|---|
| LangChain | toolkit of building blocks + integrations; not a model, not intelligence |
| Chain / LCEL | fixed composed sequence via `prompt | model | parser` — a workflow |
| Output parser | text → typed object, with validation at the boundary |
| @tool | docstring becomes the description the model reads — write it properly |
| Memory | buffer / window / summary — bookkeeping, not a bigger window |
| Tracing | LangSmith & friends — mandatory for multi-step agents |
| The critique | abstractions hide the prompt; always be able to see what you send |
Practice Zone — PYQs from real selection rounds
Six MCQs and a code-reading task — explain an LCEL chain line by line and classify it correctly.
What problem does LangChain primarily solve?
Asked in

In LangChain, a chain is:
Asked in

What does an output parser do in a chain?
Asked in

LangChain "memory" components exist because:
Asked in

A common criticism of heavy framework use is:
Asked in

What is LangSmith used for?
Asked in

Hands-on task:
Explain what each part of this chain does, and say whether it is an agent or a workflow.
Asked in

from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import JsonOutputParser
prompt = ChatPromptTemplate.from_template(
"Extract product and urgency from this complaint as JSON.\n\n{complaint}"
)
chain = prompt | model | JsonOutputParser()
result = chain.invoke({"complaint": "my new mixer is sparking!"})FAQ
LangChain or LlamaIndex?
Overlapping, with different centres of gravity: LlamaIndex started around data ingestion and retrieval, LangChain around general composition and agents. Both now cover both. Pick by which abstractions fit your problem — and note that neither improves answer quality by itself.
Is LangChain used in production?
Widely, often alongside LangGraph for agent control flow and LangSmith for tracing. Teams that outgrow it usually keep the integrations and replace the orchestration — which is the argument for keeping prompts and tools framework-agnostic.
What should I actually learn for interviews?
The vocabulary (chains, LCEL, tools, retrievers, memory), the fact that chains are workflows, and the ability to write the raw agent loop without a framework. That combination handles both service-company recall questions and product-company depth questions.
Next lesson: the framework built specifically for agent control flow — Lesson 5: LangGraph Explained →


