LangChain ecosystem: interview drills
- Advanced
- 40 min
- Lesson 7 of 7 in LangChain ecosystem
- Last verified
Select text in the lesson first to keep it with your note. With the keyboard, move focus here and press the button: the note goes with the section you are reading.
In this module
On this page
Before you start
You will be able to
- Give a 90-second answer on how LangChain, LangGraph and LangSmith fit together, with a stance on the simplest tool that works and a case for using none of them.
- Work the standard derivations: checkpoint storage volume, cost per resolved conversation, a trace sampling budget and the odds that every retry fails.
- Structure a 40-minute design answer for an agent with approvals, from clarifying questions to deployment and failure modes.
- Diagnose a described symptom, such as a double refund, a forgetful chat or a rising bill, by naming the likely causes in order and the first thing to check.
A request arrives from management: a helpdesk assistant, to be designed in forty minutes.
Vihaan opens the toolkit list and reaches for the nearest part. Under the request, in capitals, is one rule: NAME THE JOB BEFORE YOU NAME THE PART.
Where do you start?
Concept
This lesson turns the module into practice. Everything below can be built from lessons 1 to 6. The point is to say it aloud, in a structure an interviewer can follow, against a clock. Answer each prompt before you open its key. A drill you only read teaches little.
All questions are Common industry pattern or Generated practice, and none is verified as asked by a named company. A sample answer is one good answer, not the only one. Product and API names are those of the docs read on 2026-10-21; if your interview uses a newer version, say which version you last read.
Why It Matters
Knowing that a reducer merges parallel updates is not the same as explaining it in twenty seconds, or designing an approval flow in forty minutes without forgetting idempotency. Interviewers for agent roles tend to probe a few things: whether you can place each product, whether you know where state and side effects live, whether you reach for budgets and evaluation unprompted, and whether you will say when not to use the stack.
Mental Model
The rule on the card is the whole exercise. A strong answer goes in a fixed order, so you stay calm and the listener follows: say what the job needs, then pick the smallest part that does it, then say what it costs, then say how you will know it works. The order matters more than any single component.
The 90-second opener
Rehearse this until it fits in about ninety seconds:
“LangChain gives a common model interface and create_agent for the standard tool loop. LangGraph is the stateful runtime underneath it, with explicit state, saved checkpoints, interrupts and streaming, for anything custom, long-running or needing approval. LangSmith is tracing, evaluation and deployment, and it works with other frameworks too. I start with the simplest thing that works: the provider SDK, then create_agent, then a graph. I add middleware for limits, summarising and approvals, trace from day one, and gate changes with offline evaluations built from production failures.”
Then add the sentence that shows judgement: “For a single prompt with a typed answer I would call the SDK directly.”
Whiteboard derivations
Try each before reading the key.
- B1. Checkpoint volume. 20,000 conversations a day, 12 saved steps each, 40 KB of state per step. How much is written per day?
- B2. Cost per resolved conversation. 5 model calls at 1 cent each, plus 1 cent of other cost, per conversation; 70 percent are resolved without a person.
- B3. A trace budget. Keep 10 percent of ordinary conversations and every errored run. 20,000 conversations a day, 3 percent error. How many traces a day, assuming errors are spread evenly across the sample?
- B4. Retries. A tool fails transiently 5 percent of the time. It is called up to three times (one try, two retries). Failures are independent. How often do all three fail?
- B5. Loop cap. A graph can take 12 normal steps. You set the recursion limit to 50. What does that allow, and what would you change?
Key.
- B1: checkpoints; a day (decimal). That is why state must hold references, not documents, and why retention matters.
- B2: per conversation; per resolved conversation. Cost per resolved task, not per call, is the number to track.
- B3: 10 percent of 20,000 is 2,000 sampled. Errors are 3 percent, or 600. If errors are spread evenly, 10 percent of them (60) are already in the sample, so 540 more: about 2,540 traces a day.
- B4: , or 0.0125 percent, about 1 run in 8,000. In practice failures are correlated (an outage hits every attempt), so retries help less than this suggests, which is why you also need a fallback.
- B5: The limit allows about four times the normal path before the run is cut off. That tolerates a few retries, but a loop that repeats a step could burn many times the normal cost first. Add a model-call limit and a step counter in state, and treat hitting the limit as an alert.
Design drill A: a support agent with refunds (40 minutes)
Prompt. Design a support agent for an online retailer. It answers policy questions, looks up orders and issues refunds up to a limit. About 20,000 conversations a day.
A framework to say aloud.
- Clarify. Channels and languages, latency target, the refund policy and who approves, compliance, what counts as resolved.
- Shape. A cheap router sends policy questions down a retrieval path and order questions down an action path. The action path needs a fixed validation and an approval step, so use a graph, not a bare
create_agent. - State and memory. One thread per conversation on a database-backed checkpointer. A store for customer preferences. The authenticated customer id passed as runtime context, never chosen by the model.
- Tools. Order lookup, policy search, and a refund tool with an idempotency key, an amount cap and an ownership check. The refund sits behind an interrupt above a threshold, with a second approver above a higher one.
- Guardrails. Redact personal data before tracing; treat tool and retrieval text as untrusted; per-run limits on model calls, tool calls, time and money; a kill switch.
- Evaluation. A dataset from historical tickets plus adversarial cases (injection, a wrong order id, policy edge cases). Trajectory checks (the right tool, no refund without approval), online checks for groundedness, and a human review queue.
- Deployment. A hosted or self-hosted agent server, workers scaled on queue depth, a gradual release by traffic share, a rollback path for graph and prompt together, and a decided double-texting strategy.
- Failure modes. A provider outage (fallback model), a duplicate resume (idempotent refund), stale policy documents (index freshness), long histories (measure what summarising loses).
Markers of a strong answer. Idempotency, authorisation and budgets raised without being asked; retrieval quality separated from answer quality; what you would not automate; cost per resolved ticket; escalation criteria; a rollback story. Expect a change of constraint (“volume is ten times higher”, “the data cannot leave the country”). Re-cost aloud and name the risk you accept.
Design drill B: a research agent (40 minutes)
Prompt. Take a company name and produce a sourced brief in under ten minutes.
Key points: a planner emits tasks and a Send starts one worker per source; an append reducer collects findings; deduplicate and rank sources; the final writer is forced to cite, with structured output; a deadline and a budget per task, with partial results on failure; progress streamed to the user; checkpoints so a crash does not repeat searches; evaluation on citation accuracy, coverage against a rubric, and hallucination rate; a cheap model for extraction and a stronger one for synthesis; and web pages as untrusted content, so the summariser step has no tools.
Design drill C: a code-review assistant (30 minutes)
A pull-request event starts a graph: fetch the diff, split by file, run parallel reviewers (security, style, tests) with Send, merge and deduplicate, rank, and post comments. Discuss context limits, false positives as the key metric, posting comments idempotently so a retry does not comment twice, caching unchanged files, rate limits, secrets in diffs, and an evaluation built from past accepted and rejected comments.
Debugging drills
Say the likely causes aloud, in order, before reading the right-hand column.
| Symptom | Causes to walk through, and the first check |
|---|---|
| The agent loops until the recursion error | No stop condition; a tool error the model cannot see; ambiguous tool descriptions; no call limit. First: the last few tool calls in the trace |
| An approved refund is issued twice | A side effect before the interrupt (the node restarts); a duplicate resume; no idempotency key. First: where the refund call sits relative to the interrupt |
| The chat forgets earlier turns | No checkpointer; a new thread id on each request; an in-memory saver behind several replicas. First: the thread id on consecutive traces |
| Duplicated messages in state | A reducer misused; a node re-adding history. First: what the node returns |
| Parallel branches raise an invalid update | A key written by two nodes without a reducer. First: the state definition |
| The bill tripled after a release | A changed prompt prefix defeating caching; summarising turned off; more tool calls; bigger retrieved chunks; retries. First: tokens per run, by run type, in the traces |
| The evaluation score is up and users are unhappy | Judge bias; a dataset that no longer matches real questions; a slice that got worse; latency. First: scores by slice and a read of ten failures |
| It works in the local dev server and loses state in production | In-memory persistence locally against a database in production; replicas with no shared store. First: which persistence each environment uses |
| A tool returned another customer’s data | A model-supplied id; missing ownership check; a shared cache key. First: where the id in the call came from |
Live coding set
Thirty to forty-five minutes each, aloud. Judged on correctness, state and reducer choices, boundedness, tests and explaining trade-offs.
- A tool-calling loop in a graph with one tool, a conditional edge, a recursion limit, and a test with a scripted fake model.
- Generate, validate, retry at most three times, with a counter in state.
- A map-reduce summariser with
Sendand an append reducer. - An approval flow with an interrupt and a resume command, an idempotent action, and tests for approve and reject using the in-memory saver.
- Middleware: one that routes short prompts to a cheaper model, and one that enforces a tool allowlist.
- An evaluation harness: ten examples, a code evaluator and a judge, comparing two prompts.
Rapid-fire
Answer each in about twenty seconds.
- What is
create_agentbuilt on? - What replaced
create_react_agent? - Why is a pipe chain wrong for a retry loop?
- What does a reducer do?
- What is a super-step?
- Checkpointer or store for a user’s language preference?
- What goes wrong if a side effect sits before
interrupt? Command(resume=...)orCommand(goto=...)?- When do you use
Send? - Run, trace, thread?
- Offline or online evaluation, and what can online not use?
- Can LangSmith trace code that does not use LangChain?
- Name the four double-texting strategies.
- Where does the tenant id come from?
- What does replaying a checkpoint risk?
- How do you bound an agent?
Key. 1. LangGraph. 2. create_agent from langchain.agents. 3. A pipe chain has no cycles or saved state; a graph has both. 4. It is the merge rule for one state key; parallel writes need it. 5. A round of parallel node runs, merged at the boundary. 6. The store, because it must outlive a thread. 7. The node restarts on resume, so the effect runs again. 8. Resume supplies the human’s answer to a paused run; goto routes and updates from a node. 9. For a fan-out whose count is only known at run time. 10. A unit of work; the runs of one operation; the traces of one conversation. 11. Offline uses a dataset before release; online runs on live traffic and has no reference outputs. 12. Yes, with a decorator, a context manager or an integration. 13. Enqueue, reject, interrupt, rollback. 14. The authentication context, passed as runtime context, never the model. 15. Nodes after the checkpoint run again, so model calls and side effects repeat. 16. Model and tool call limits, a recursion limit, timeouts and a cost budget.
Mock plan (45 minutes)
| Minutes | Part | Prompt |
|---|---|---|
| 0 to 5 | Warm-up | “How do LangChain, LangGraph and LangSmith relate, and when would you use none of them?” |
| 5 to 15 | Depth | Reducers and super-steps; interrupt behaviour; checkpointer versus store; the middleware hooks |
| 15 to 35 | Design | Drill A, or drill B at the interviewer’s choice |
| 35 to 42 | Debug | Two symptoms from the table, at random |
| 42 to 45 | Close | The three biggest risks and what you would measure first |
The interviewer does not teach during the mock. Afterwards, note the two places you lost the thread, and repeat those drills on a nearby variant a few days later.
Real-World Application
Run the mock with a friend. A 35-minute version: the opener, two derivations, one scenario. A 45-minute version: the full plan with one design drill, where the interviewer changes a constraint twice. A good practice habit is to record yourself answering drill A cold and then count how many of the eight parts you reached before time ran out.
Interview Perspective
Expect all of the above in any order. Signals interviewers tend to look for: you name the least autonomy that works and justify a graph over create_agent; you raise idempotency, authorisation, budgets and evaluation gates unprompted; you separate retrieval quality from generation quality; you say what to measure before optimising and how to roll back; and you are honest about the framework’s trade-offs and the speed at which it changes.
A common failure is to list product names without saying what each is for. Another is to quote an API detail from memory when the version may have changed; say “in the 1.x docs I read” and move on.
Provenance: Common industry pattern and Generated practice. None of these drills is verified as asked by a named company.
Practice Questions
- Basic: Give the 90-second answer to “How do LangChain, LangGraph and LangSmith relate?”
- Intermediate: Redo B1 for 50,000 conversations a day, 15 steps and 25 KB of state.
- Advanced: Run drill A with the constraint “the data may not leave our network”. What changes?
- Product-Company: Design an assistant that books meetings across three calendars, in 40 minutes.
Activity
Time yourself on the opener and one derivation. If either takes more than twice its budget, mark the lesson it comes from and re-read that section, then try a nearby variant instead of the same prompt.
Homework
Record yourself on drill B in 40 minutes. Play it back and list what the key covers that you missed. Rewrite your first sixty seconds so that it states the job, the smallest part that does it, and the order you will cover things.
Quick Revision
- Opener: LangChain for the quick path, LangGraph for state and control, LangSmith for tracing, evaluation and deployment; start with the SDK.
- Derivations: ; ; trace budget = sample + unsampled errors; retries all fail = (rate to the power of attempts).
- Design in eight parts: clarify, shape, state and memory, tools, guardrails, evaluation, deployment, failure modes.
- Diagnose by naming causes in order, then the first check.
- When a constraint changes, re-cost aloud and name the risk you accept.
Check yourself
- Walk-through: Design the refund agent in forty minutes, covering all eight parts.
- Variation: Redo it for an agent that books travel.
- Common misconception: “More components means a better design.” Each should trace to a need.
Related
Resources & Further Reading
Checked sources to go deeper. The essential ones come first in each group.
Official documentation
Choosing between Graph and Functional APIs (LangGraph documentation) (opens in a new tab)
Vendor guidance on choosing between the Graph and Functional APIs, useful when an interviewer asks why a graph over a plain loop.
Versioning (LangChain documentation) (opens in a new tab)
The versioning policy behind the advice to say which version of the docs you last read.
Further reading
Don't Build Multi-Agents (opens in a new tab)
A reasoned case for the simplest architecture, which prepares you for the interviewer who asks when you would use none of the stack.
More for this module: LangChain ecosystem resources
Practice
Test what you just read. Quizzes and cards are grouped by module: LangChain ecosystem.
Check yourself12 questions on what this lesson set out to teach
Checking answers needs JavaScript. You can still read every question and option below.
Keyboard: arrow keys move between options. Space or Enter selects the focused option.