LangGraph interview questions and answers

10 questions from the LangGraph Interview Mock practice bank, spread across its domains. Pick your answer, then open the explanation to see why each option is right or wrong.

  1. Question 1Graph Fundamentals

    What does this loop receive on each iteration (default v1 format)?

    for item in graph.stream(inputs, stream_mode=["updates", "custom"]):
        print(item)
    • A

      A (mode, data) tuple, e.g. ('custom', {...})

    • B

      A plain dict, and you cannot tell which of the two modes produced it

    • C

      A dict with type, ns and data keys

    • D

      A (namespace, data) tuple

    Show the answer and explanation

    Answer: A

    v1 output shape depends on options: one mode gives raw data, several modes give (mode, data), subgraphs=True adds a namespace. version="v2" replaces all of these with one {"type", "ns", "data"} dict.

    Why the other options are wrong

    • B. That is the single-mode v1 shape; lists of modes add the mode name.

    • C. That is the v2 StreamPart shape, which needs version="v2".

    • D. Namespaces are added only with subgraphs=True.

  2. Question 2Agents and Memory

    In the subagents pattern, a subagent is wrapped as a @tool. Which techniques do the docs show for controlling the context that crosses the boundary? (Choose two.)

    Choose 2.

    • A

      Read runtime.state["messages"] through ToolRuntime and pass a transformed history to the subagent when it needs prior context

    • B

      Return a Command whose update carries extra state keys plus a ToolMessage with the matching tool_call_id

    • C

      Have the subagent write straight into the supervisor's checkpoint with update_state

    • D

      Set graph=Command.PARENT in the subagent's tool so it takes over the supervisor's conversation

    • E

      Use output_mode="full_history" on create_agent

    Show the answer and explanation

    Answer: A and B

    Inputs: decide how much of the parent's state the subagent receives (query only for isolation, history to continue work). Outputs: return text, or a Command that also updates parent state keys while still answering the tool call with a ToolMessage.

    Why the other options are wrong

    • C. The docs do not show this, and it bypasses the tool-call/response pairing.

    • D. That is the handoff mechanism, which transfers control instead of returning a result to the caller.

    • E. output_mode belongs to create_supervisor; create_agent has no such parameter.

  3. Question 3Persistence and Human-in-the-Loop

    An approval node must send the graph to proceed when the reviewer approves and to cancel otherwise, with no separate routing function. Which implementation does this?

    • A
      def approval(state):
          ok = interrupt({"details": state["action"]})
          return "proceed" if ok else "cancel"
    • B
      def approval(state) -> Command[Literal["proceed", "cancel"]]:
          ok = interrupt({"details": state["action"]})
          return Command(goto="proceed" if ok else "cancel")
    • C
      def approval(state):
          target = interrupt("Type proceed or cancel")
          return Command(goto=target, resume=True)
    • D
      def approval(state):
          ok = interrupt({"details": state["action"]})
          graph.invoke(Command(goto="proceed" if ok else "cancel"))
    Show the answer and explanation

    Answer: B

    The interrupts guide's approve-or-reject pattern returns Command(goto=...) from the node that called interrupt(), annotated Command[Literal["proceed", "cancel"]] so the graph knows the possible destinations. The caller resumes with Command(resume=True) to approve or Command(resume=False) to reject.

    Why the other options are wrong

    • A. A node must return a state update or a Command; returning a bare node name is how routing functions behave, not nodes.

    • C. resume belongs in graph input, not in a node's return value, and letting the reviewer type a node name is fragile.

    • D. Invoking the graph from inside its own node starts a separate run; routing is done by returning a Command.

  4. Question 4Production and Operations

    Which statements about assistants, threads and runs on Agent Server are true? (Choose three.)

    Choose 3.

    • A

      Passing a graph ID such as "agent" as assistant_id uses that graph's default assistant

    • B

      A run can be stateless: pass None as thread_id and no conversation is kept

    • C

      A thread is permanently bound to the assistant that created it

    • D

      A second assistant can run on the same thread and see the checkpoints the first assistant wrote

    • E

      Each new assistant needs its own deployment of the graph code

    Show the answer and explanation

    Answer: A and B and D

    Assistants hold configuration, threads hold state, and runs are workloads. A run pairs an assistant with an optional thread. Graph IDs resolve to default assistants. Because threads are not tied to an assistant, you can switch configuration mid-conversation or chain specialised assistants on one thread.

    Why the other options are wrong

    • C. A thread is not tied to one assistant. A different assistant can continue on the same thread.

    • E. Many assistants can share one deployed graph. They differ only in configuration.

  5. Question 5Graph Fundamentals

    Which of these are keyword arguments of StateGraph.compile() in LangGraph 1.2? (Choose three.)

    Choose 3.

    • A

      store

    • B

      cache

    • C

      interrupt_before

    • D

      recursion_limit

    • E

      thread_id

    • F

      stream_mode

    Show the answer and explanation

    Answer: A and B and C

    The 1.2 signature is compile(checkpointer=None, *, cache=None, store=None, interrupt_before=None, interrupt_after=None, debug=False, name=None, transformers=None). Anything that varies per request (thread id, recursion limit, context, stream mode) belongs on the call.

    Why the other options are wrong

    • D. This is a per-call config key, not a compile argument.

    • E. The thread id goes in config["configurable"] on each call.

    • F. Stream mode is chosen per stream()/invoke() call.

  6. Question 6Agents and Memory

    Your team uses create_agent everywhere. Which requirements justify hand-writing a StateGraph instead? (Choose two.)

    Choose 2.

    • A

      The flow is mostly fixed: always classify, then look up the account, then branch to one of three specialist sub-flows, with the model used only inside some steps

    • B

      Retrieved documents must be graded, with a bounded rewrite-and-retry loop and a parallel web-search branch

    • C

      The agent must remember earlier turns of the conversation

    • D

      One tool must pause for human approval before it runs

    • E

      The final answer must be a validated Pydantic object

    Show the answer and explanation

    Answer: A and B

    create_agent covers memory (checkpointer), approval (middleware), typed output (response_format), custom state (state_schema) and runtime context (context_schema). Drop to a hand-written StateGraph when the shape of the flow must be guaranteed: required deterministic steps, custom loops, parallel branches. The two can be combined, because a create_agent graph can be a node inside your graph.

    Why the other options are wrong

    • C. create_agent accepts a checkpointer; pass a thread_id to keep history.

    • D. HumanInTheLoopMiddleware handles that on create_agent.

    • E. response_format= on create_agent returns structured_response.

  7. Question 7Persistence and Human-in-the-Loop

    A graph START -> node_a -> node_b -> END has finished on thread 1. What do values and next show after this update?

    class State(TypedDict):
        foo: str
        bar: Annotated[list[str], operator.add]
    
    # node_a returns {"foo": "a", "bar": ["a"]}; node_b returns {"foo": "b", "bar": ["b"]}
    graph.update_state(cfg, {"foo": "m", "bar": ["manual"]})
    snap = graph.get_state(cfg)
    print(snap.values, snap.next)
    • A

      {'foo': 'm', 'bar': ['manual']} ()

    • B

      {'foo': 'm', 'bar': ['a', 'b', 'manual']} ()

    • C

      {'foo': 'm', 'bar': ['a', 'b', 'manual']} ('node_a',)

    • D

      {'foo': 'b', 'bar': ['a', 'b']} (), because a finished thread cannot be updated

    Show the answer and explanation

    Answer: B

    update_state behaves like a node write: values go through the reducers, so an update to a list with operator.add accumulates instead of replacing it. Keys without a reducer are simply overwritten. The new checkpoint has source == "update".

    Why the other options are wrong

    • A. bar has an add reducer, so the update is appended, not swapped in.

    • C. An update does not restart the graph; next follows from the node it is attributed to.

    • D. Finished threads accept updates; this is how you correct state after the fact.

  8. Question 8Production and Operations

    An assistant's configuration has model, system_prompt and max_search_results. A developer changes the prompt like this:

    await client.assistants.update(asst_id, context={"system_prompt": NEW_PROMPT})

    Afterwards, runs use the graph's default model and search limit. Why?

    • A

      context can only hold one key at a time

    • B

      The update failed silently, so runs fall back to defaults

    • C

      Updating an assistant always resets it to the graph's default assistant

    • D

      Assistant updates do not merge. The new version contains only the fields that were sent

    Show the answer and explanation

    Answer: D

    Each assistants.update creates a new version from the payload you send, and it does not merge with the previous version. Include every field you want to keep. The fix is to send the full configuration. Rolling back is easy as well: older versions remain and can be made active again.

    Why the other options are wrong

    • A. Context can hold many keys. They all have to be sent together.

    • B. The update worked. The prompt changed. The other fields were dropped because they were not sent.

    • C. Each update creates a new version of that assistant. It is not a reset to the default assistant.

  9. Question 9Graph Fundamentals

    For a graph built on MessagesState, which of these are accepted as the messages value in graph.invoke({"messages": ...})? (Choose three.)

    Choose 3.

    • A

      [{"role": "user", "content": "hi"}]

    • B

      "hi"

    • C

      [("user", "hi")]

    • D

      [{"content": "hi"}]

    • E

      42

    Show the answer and explanation

    Answer: A and B and C

    add_messages coerces message-like input: message objects, strings, (role, content) tuples and dicts with a role. A dict missing its role, or a non-message value, fails during conversion, before any node runs.

    Why the other options are wrong

    • D. A message dict without role (or type) raises ValueError because the reducer cannot tell what kind of message it is.

    • E. An integer is not a message-like value, and conversion raises NotImplementedError.

  10. Question 10Agents and Memory

    To expire scratch memories automatically, a developer writes store.put(ns, key, value, ttl=60) against InMemoryStore(). What happens?

    • A

      The item is stored and deleted 60 seconds later

    • B

      It raises NotImplementedError because InMemoryStore does not support TTL

    • C

      The item is stored, and the TTL is quietly ignored

    • D

      The item expires after 60 reads

    Show the answer and explanation

    Answer: B

    BaseStore.put raises NotImplementedError when ttl is set on a store whose supports_ttl is False. InMemoryStore is one of those stores. Stores that support TTL (for example SqliteStore from langgraph-checkpoint-sqlite) accept a TTL per item or a TTLConfig with default_ttl, refresh_on_read and sweep_interval_minutes.

    Why the other options are wrong

    • A. TTL is not supported by InMemoryStore, and TTL values are minutes, not seconds.

    • C. It is not ignored. ttl=None is the only value accepted without TTL support.

    • D. TTL is time-based. Reads can refresh the timer but are not counted.

Practise all 450 LangGraph questions

Start with the free 15-question diagnostic. It shows where to focus, and your results carry over if you sign up.

Go to LangGraph