LangChain ecosystem: interview drills

  • Advanced
  • 40 min
  • Lesson 7 of 7 in LangChain ecosystem
  • Last verified

Open slides(33 slides)

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.

Diagram: A strong answer follows a fixed order: say what the job needs, pick the smallest part that does it, say what it costs, then say how you...

1 What the job needs

2 The smallest part that does it

3 What it costs

4 How you will know it works

Diagram summary: A strong answer follows a fixed order: say what the job needs, pick the smallest part that does it, 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: 20,000×12=240,00020{,}000 \times 12 = 240{,}000 checkpoints; 240,000×40 KB=9.6 GB240{,}000 \times 40\ \text{KB} = 9.6\ \text{GB} a day (decimal). That is why state must hold references, not documents, and why retention matters.
  • B2: (5×1+1) cents=6 cents(5 \times 1 + 1)\ \text{cents} = 6\ \text{cents} per conversation; 6÷0.7≈8.6 cents6 \div 0.7 \approx 8.6\ \text{cents} 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: 0.05×0.05×0.05=0.0001250.05 \times 0.05 \times 0.05 = 0.000125, 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.

  1. Clarify. Channels and languages, latency target, the refund policy and who approves, compliance, what counts as resolved.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. Failure modes. A provider outage (fallback model), a duplicate resume (idempotent refund), stale policy documents (index freshness), long histories (measure what summarising loses).
Diagram: A router sends policy questions to retrieval and order questions to a lookup, a validation step, and either an approval pause or a direct...

policy

order

over threshold

within limit

Customer message

Router: cheap model

Retrieve and answer

Lookup order

Validate request

Interrupt: human approval

Refund with idempotency key

Traces and online checks

Dataset and evaluation

Diagram summary: A router sends policy questions to retrieval and order questions to a lookup, a validation step, and either an approval pause or a direct refund with an idempotency key; all paths are traced, and failures feed the evaluation dataset.

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.

Diagram: A planner emits tasks and a Send starts one worker per source.

Company name

Planner emits tasks

Worker: source 1

Worker: source 2

Worker: source N

Append reducer collects findings

Deduplicate and rank sources

Writer: structured output, must cite

Sourced brief

Diagram summary: A planner emits tasks and a Send starts one worker per source. An append reducer collects the findings, which are deduplicated and ranked before a writer produces a cited brief. A deadline and a budget per task give partial results on failure, and checkpoints stop a crash from repeating searches.

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.

Diagram: A pull-request event fetches the diff, splits it by file, and runs parallel reviewers with Send.

Pull-request event

Fetch the diff

Split by file

Security reviewer

Style reviewer

Tests reviewer

Merge and deduplicate

Rank

Post comments, idempotently

Diagram summary: A pull-request event fetches the diff, splits it by file, and runs parallel reviewers with Send. Findings are merged, deduplicated and ranked, then posted as comments with an idempotency key so a retry cannot comment twice.

Debugging drills

Say the likely causes aloud, in order, before reading the right-hand column.

SymptomCauses to walk through, and the first check
The agent loops until the recursion errorNo 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 twiceA 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 turnsNo 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 stateA reducer misused; a node re-adding history. First: what the node returns
Parallel branches raise an invalid updateA key written by two nodes without a reducer. First: the state definition
The bill tripled after a releaseA 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 unhappyJudge 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 productionIn-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 dataA 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.

  1. A tool-calling loop in a graph with one tool, a conditional edge, a recursion limit, and a test with a scripted fake model.
  2. Generate, validate, retry at most three times, with a counter in state.
  3. A map-reduce summariser with Send and an append reducer.
  4. An approval flow with an interrupt and a resume command, an idempotent action, and tests for approve and reject using the in-memory saver.
  5. Middleware: one that routes short prompts to a cheaper model, and one that enforces a tool allowlist.
  6. An evaluation harness: ten examples, a code evaluator and a judge, comparing two prompts.

Rapid-fire

Answer each in about twenty seconds.

  1. What is create_agent built on?
  2. What replaced create_react_agent?
  3. Why is a pipe chain wrong for a retry loop?
  4. What does a reducer do?
  5. What is a super-step?
  6. Checkpointer or store for a user’s language preference?
  7. What goes wrong if a side effect sits before interrupt?
  8. Command(resume=...) or Command(goto=...)?
  9. When do you use Send?
  10. Run, trace, thread?
  11. Offline or online evaluation, and what can online not use?
  12. Can LangSmith trace code that does not use LangChain?
  13. Name the four double-texting strategies.
  14. Where does the tenant id come from?
  15. What does replaying a checkpoint risk?
  16. 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)

MinutesPartPrompt
0 to 5Warm-up“How do LangChain, LangGraph and LangSmith relate, and when would you use none of them?”
5 to 15DepthReducers and super-steps; interrupt behaviour; checkpointer versus store; the middleware hooks
15 to 35DesignDrill A, or drill B at the interviewer’s choice
35 to 42DebugTwo symptoms from the table, at random
42 to 45CloseThe 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: checkpoints=conversations×steps×state size\text{checkpoints} = \text{conversations} \times \text{steps} \times \text{state size}; cost per resolved task=cost per attemptresolution rate\text{cost per resolved task} = \dfrac{\text{cost per attempt}}{\text{resolution rate}}; trace budget = sample + unsampled errors; retries all fail = pattemptsp^{\text{attempts}} (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.

Resources & Further Reading

Checked sources to go deeper. The essential ones come first in each group.

Official documentation

Further reading

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.

0 of 12 answered

Keyboard: arrow keys move between options. Space or Enter selects the focused option.

ObjectiveGive 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.

  1. Question 1 of 12An interviewer asks how the three products relate. Which opening is the strongest?

    Choose one answer.

  2. Question 2 of 12After the opener, which closing sentence shows the best judgement?

    Choose one answer.

ObjectiveWork the standard derivations: checkpoint storage volume, cost per resolved conversation, a trace sampling budget and the odds that every retry fails.

  1. Question 3 of 1230,000 conversations a day each save 10 checkpoints of 20 KB. About how much does the checkpointer write per day?

    Choose one answer.

  2. Question 4 of 12A conversation costs 8 cents to run, and 80 percent of conversations are resolved without a person. What is the cost per resolved conversation?

    Choose one answer.

  3. Question 5 of 12A tool fails transiently 10 percent of the time, with independent failures, and is tried up to three times in total. How often do all attempts fail?

    Choose one answer.

  4. Question 6 of 12In real traffic the retry odds from the previous calculation turn out worse than predicted. What is the usual reason?

    Choose one answer.

ObjectiveStructure a 40-minute design answer for an agent with approvals, from clarifying questions to deployment and failure modes.

  1. Question 7 of 12In the 40-minute refund-agent drill, what belongs in the first few minutes?

    Choose one answer.

  2. Question 8 of 12Where should the refund call sit in the approval node, and how is a duplicate approval handled?

    Choose one answer.

  3. Question 9 of 12Which is a marker of a strong design answer that interviewers look for?

    Choose one answer.

ObjectiveDiagnose 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.

  1. Question 10 of 12An approved refund went out twice. Which cause should you check first?

    Choose one answer.

  2. Question 11 of 12A chat that works locally forgets earlier turns in production. Which cause fits best?

    Choose one answer.

  3. Question 12 of 12The bill tripled after a release and the prompt text looks unchanged. Which first check is most useful?

    Choose one answer.