LangChain and LangGraph · Chapter 25 of 25

Interview round

By the end of this chapter you have answered five timed questions, one idea each, from across the whole lab: a batch that respects a rate limit, retrieval that knows when to refuse, a graph's progress step by step, parallel nodes writing the same key, and a paused run that survives a restart. Build it in your browser: a real editor and terminal, AI that explains, and tests that tell you when it works.

  • Part: Production
  • 5 tasks
  • Python
  • In the all labs plan

The first 2 chapters of LangChain and LangGraph are free. This one comes with the all labs plan.

Why you need this

The assistant went live, and RoomRaja is hiring a second AI engineer. Sid will not hand the assistant to anyone who has only read about it. "Short problems, ten minutes each. I am not checking that you remember LangChain's names; the docs have them. I am checking that you know what each piece does inside, and that you look at what really reached the model before you guess." Tanvi liked the idea so much that the round is now the last chapter of the lab.

Each question is one idea from an earlier chapter, with no hand-holding: the file has the goal, the check has the edge cases. Below is a refresher of each idea, with what an interviewer listens for. The answers are not here.

What you build: 5 tasks

Each task has tests. You write the code in the lab's editor and press Check.

  1. Task 1 · interview question

    Interview: triage.py, three at a time

    Time yourself: 10 minutes. Write triage(messages): classify each message into the nine intents of messages.jsonl with a prompt template, structured output and a ChatOpenAI for lab-chat-limited with max_retries=0, sending them all with batch, never more than 3 at a time. Return the intents in the order of the messages.

    lab-chat-limited answers 3 requests at a time and refuses a 4th with a 429. The check sends 8 messages, some with braces in them, and every one must reach the model exactly as written.

  2. Task 2 · interview question

    Interview: refuse.py, retrieve or refuse

    Time yourself: 10 minutes. Write answer(question): the policy's numbered rules embedded with lab-embed in an InMemoryVectorStore (built once, at import); find the 2 nearest rules with their scores; when the best score is below 0.3 return exactly Sorry, the policy does not cover that. Mrunal will reply to you soon. and ask no model; otherwise ask lab-chat to answer from those 2 rules and return the reply's text.

    The check asks two questions the policy covers and two it does not. The interviewer will ask: where does 0.3 come from, and what would you do with a question that scores 0.29?

  3. Task 3 · interview question

    Interview: progress.py, which nodes ran

    Time yourself: 10 minutes. Write nodes_run(graph, inputs): run the compiled graph once with these inputs and return the names of the nodes it went through, in order, a node that ran several times listed each time. The check runs its own graphs, a loop and a branch, and counts how often each node ran.

  4. Task 4 · interview question

    Interview: checks.py, three checks at once

    Time yourself: 10 minutes. Write build(), returning a compiled graph whose state has tenant_id and issues (a list of strings) and three nodes, each straight from START: rent_check adds rent due: N when roomraja.rent_due says something is due; notice_check adds notice given on YYYY-MM-DD when the tenant gave notice; ticket_check adds open ticket TKnnnn for each ticket of the tenant's room with status open in tickets.json.

    The check invokes it with {"tenant_id": ..., "issues": []} for four tenants. The interviewer will ask: two nodes write the same key in the same step; what does LangGraph do, and why?

  5. Task 5 · interview question

    Interview: restart.py, resume after a restart

    Time yourself: 10 minutes. Write a graph: estimate (roomraja.deposit_refund_estimate for the tenant), then, only when it needs approval, a manager node that pauses with interrupt and takes True or False as the decision; its checkpoints kept in SQLite at db_path. start(db_path, thread_id, tenant_id) returns {"status": "waiting", "refund": N} when it waits and {"status": "approved", "refund": N} when it needs no approval. finish(db_path, thread_id, approved) resumes the waiting run and returns {"status": "approved" or "rejected", "refund": N}, or raises ValueError when nothing waits in that thread.

    The check calls each in a new Python process. The interviewer will ask: what does a checkpoint hold, and why must it outlive the process?

What you will learn

  • How to work a timed question: say the plan, build the smallest thing that runs, then look at the requests.
  • Five ideas again, at interview depth: templates and batches (chapters 2 to 5), retrieval scores (8 and 11), streaming a graph (18), reducers (19), and checkpoints (17 and 21).

More in Production

Build "Interview round" yourself

RoomRaja, a Pune co-living company, answers tenants on WhatsApp by hand. You build its assistant. A real editor and terminal in your browser, AI that explains, and a Check that says when it works.

The first 2 chapters of LangChain and LangGraph are free. This one comes with the all labs plan.