Skip to content
Forward Deployed

Forward Deployed
Lessons and contents
Learn

LangGraph Core: Graphs, State & Control Flow: interview questions

Source
From the RAG & Agents Engineering course
By
Sourav Banerjee
Last updated
8 Nov 2026

Report an issue

Production questions of the kind asked in applied AI engineering interviews.

1. After a refactor of Larkspur's support graph, token cost per conversation doubles and the model starts repeating the customer's question back. No test fails. What do you look for?

What a strong answer covers:

  • Prints the messages list after each node with stream_mode="values" and counts copies of the first human message, rather than reading the final answer
  • Checks the reducer on messages and what each node returns: operator.add with a node that returns state["messages"] + [msg] doubles the list on every step (1, 3, 7 in the T4.3 lab)
  • Fixes it at the schema with add_messages, which replaces messages with a known id, or by returning only the new message, and keeps one convention across the graph
  • Adds a test that asserts the message count and the number of human messages after a two-node run

2. The triage step can be a conditional edge reading route, or a classify node that returns Command(goto=...). Which do you choose for Larkspur, and what changes in testing and debugging?

What a strong answer covers:

  • A conditional edge keeps routing a pure function of state: it can be unit-tested without the graph, and the graph shows every destination at build time
  • Command fits when the node that decides also writes, for example the route plus the reason for it, in one return
  • Names the Command traps: the Literal annotation is only for drawing, a misspelled goto ends the run with a warning, and a static edge from the same node runs as well
  • Logs the route in state either way, so a trace shows which branch ran and why

3. How do you know, week by week, that the router sends questions to the right handler?

What a strong answer covers:

  • Keeps a labelled set of real questions with the handler each should reach, and runs the router alone against it on every rule or prompt change
  • Reads the confusion matrix as well as accuracy: a billing question sent to technical costs less than a refund question sent nowhere
  • Tracks the route distribution and the fallback rate in production; a jump in human handoffs after a release means the rules stopped matching
  • Samples close calls such as Can I export my data after I cancel my plan?, where rule order, not meaning, picked billing

4. A release renames the technical node to tech_support. The router node returns Command(goto="technical"). Outage questions now get no answer and the error rate stays at zero. Why, and how do you stop it happening again?

What a strong answer covers:

  • In LangGraph 1.2.18 a goto to a missing node logs "wrote to unknown channel … ignoring it" and the run ends normally with no answer key
  • Finds it in the output: the final state has no answer key, so a caller that reads it gets nothing, while the error logs stay empty
  • Prevents it with names held in one constant or enum, a test that every route reaches an answer node, and an alert on runs that end without an answer
  • Notes that a conditional edge with a destination list fails loudly instead, with a KeyError for an unknown name

5. The support graph becomes an API that a web widget calls. What do you put at the boundary, and what stays inside the graph?

What a strong answer covers:

  • A Pydantic state schema, so a malformed request fails at invoke before any node or model call runs; a Pydantic input_schema on a TypedDict state does not check types in LangGraph 1.2.18
  • An input schema with only question and an output schema with only the structured answer, so route, the message history and counters such as llm_calls never leak to the client
  • Remembers that Pydantic checks the input but not node writes, so nodes that produce the answer still validate it themselves
  • Passes the customer id and database client as runtime context and per-call settings such as language in config, not as state the graph would return or save

Rate your confidence and keep notes on the module page.