Interview: LangChain and LangGraph
Framework questions: what LangChain gives you, LCEL and runnables, why LangGraph exists, state and reducers, conditional edges and cycles, checkpointing and threads, human-in-the-loop, streaming and multi-agent graphs - with when to use each.
What you will be able to do
- Explain what LangChain provides and what LCEL is
- Explain LangGraph state, nodes, edges and reducers
- Describe cycles, conditional edges and recursion limits
- Explain checkpointing, threads and human-in-the-loop
- Choose between a chain, a graph and no framework
The idea, in plain English
Many job descriptions name LangChain and LangGraph, so expect specific questions: how state works, what a reducer is, how a graph loops and stops, and how to pause for a human.
Interviewers also test judgement: why use a framework at all, and when is LangGraph better than a plain chain?
Modules 2 and 3 built every piece; use them as examples.
Worked example: Fourteen framework questions answered with the graphs built in Module 3 and the chains of Module 2.
Basic: What is LangChain?
A Python (and JavaScript) framework of building blocks for LLM apps: model wrappers, prompt templates, output parsers, tools, retrievers and a way to chain them (LCEL).
- Standard interfaces let you swap models and stores.
- Lesson 2.1 discusses why a framework helps - and what it costs.
Basic: What is LangGraph, and why does it exist?
LangGraph builds agents as graphs: shared state, nodes that update it, and edges that decide what runs next - including loops. It exists because agents need cycles, branching, persistence and human pauses, which simple chains do not handle well.
- Chains are straight lines; agents loop.
- Lesson 3.1: why graphs, not chains.
Basic: What are state, nodes and edges in LangGraph?
State is a typed dictionary shared by the graph. A node is a function that reads the state and returns updates. An edge says which node runs next - fixed, or chosen by a function (a conditional edge).
- Nodes return partial updates, not the whole state.
- Lesson 3.2.
Intermediate: What is a reducer in LangGraph state?
A reducer decides how a node's update is combined with the existing value - for example add_messages appends new messages instead of replacing the list.
- Without a reducer, an update overwrites the field.
- Important for message history and parallel branches.
Intermediate: How do conditional edges work?
A conditional edge calls a routing function on the current state; its return value picks the next node - for example "tools" if the last message has tool calls, otherwise END.
- Keep routing functions simple and deterministic.
- Lesson 3.3.
Intermediate: How do you stop a LangGraph agent from looping forever?
Count steps in the state and route to an end or give-up node when a limit is reached. LangGraph's recursion_limit is a final safety net that raises an error when too many steps run.
- Your own limit gives a clean answer; the recursion limit gives an exception.
- Lesson 3.4.
Intermediate: What are checkpointers and threads?
A checkpointer saves the graph state after every step. A thread_id names one conversation, so the graph can continue it later, recover after a crash, or be inspected and replayed.
- In-memory checkpointers for tests; database-backed ones for production.
- Lesson 3.6.
Intermediate: How does human-in-the-loop work in LangGraph?
The graph interrupts before (or inside) a node, saves its state with the checkpointer, and waits. A person reviews or edits, then the graph resumes from the saved state.
- Needs a checkpointer, because the process may wait minutes or days.
- Use it before risky actions. Lesson 3.7.
Intermediate: What streaming options does LangGraph have?
You can stream state values after each step, only the updates, or tokens from the model as they are generated - so users see progress instead of waiting.
- Token streaming improves perceived speed.
- Step streaming helps debugging. Lesson 3.9.
Advanced: How do you build a multi-agent system in LangGraph?
Make each agent a node or subgraph and connect them with a supervisor node that routes work, or with hand-offs where one agent passes control to another. Shared state carries messages and results.
- Keep each agent's tools and prompt focused.
- Watch total calls and cost. Lesson 3.8.
Advanced: When would you not use LangChain or LangGraph?
For a simple app, plain code with the model's SDK can be clearer, faster and easier to debug. Frameworks add abstraction, version churn and learning cost; they pay off for complex agents, persistence and integrations.
- Module 1 built agents with no framework at all.
- Know what the framework does underneath.
Advanced: What is LCEL, and what are its benefits?
The LangChain Expression Language composes components with the | operator into runnables that share one interface - invoke, batch and stream - with built-in parallelism and tracing.
- prompt | model | parser.
- Every runnable can be streamed or batched the same way. Lesson 2.4.
Advanced: How would you test a LangGraph agent?
Unit-test nodes as plain functions with sample state, test routing functions with crafted states, replace the model with a fake in tests, and run end-to-end evaluations on real tasks with tracing.
- Deterministic parts get normal tests; model behaviour gets evaluations.
Advanced: How do you deploy a LangGraph agent?
Build the graph once at startup, serve it behind an API (for example FastAPI), use a persistent checkpointer, set timeouts and concurrency limits, and trace runs in production.
- Lesson 5.7 packages an agent as a command and a web service.
Key points
- LangChain gives building blocks; LangGraph gives control flow with state.
- State + nodes + edges; reducers decide how updates merge.
- Limit loops yourself; recursion_limit is the last safety net.
- Checkpointers and threads enable memory, resume and human-in-the-loop.
- Use a framework when its features pay for its complexity.
Interview questions
What does END mean in LangGraph?
The graph stops and returns the final state.
What is a StateGraph?
The LangGraph builder for graphs with a typed shared state.
What is a ToolNode?
A prebuilt node that runs the tool calls in the last message.
What is add_messages?
A reducer that appends messages to the history.
What does compile() do?
Turns the graph definition into a runnable app, optionally with a checkpointer.
What is a subgraph?
A graph used as a node inside another graph.
What is invoke vs stream?
invoke returns the final result; stream yields results as they happen.
Why a thread_id?
To keep and resume one conversation's saved state.
Comments
Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.
Loading comments...