Platform Engineering · Lesson 171

LangGraph: Stateful Graphs for Multi-Agent Work

Lesson 170 taught me chains. One step runs, its output feeds the next step, and the chain forgets everything else. That works until the work needs memory. A triage agent that forgets what it already tried. A plan that needs a human to read it before it runs. A run that crashes halfway and has to start over. That is where LangGraph comes in. It is the stateful layer on top of LangChain. Nodes do the work, edges move the state, and a checkpointer saves the state after every node. The graph can branch on what it knows, stop for a human, and resume after a crash. This lesson follows one alert through that graph, hop by hop, and shows the two ways it goes wrong: a low-confidence diagnosis that has to reroute to a human, and a lost checkpoint that makes the graph rebuild its own memory.

Difficulty: Advanced · Know this first: Lesson 170, Lesson 63

What you will build

One file, graph.py, and you keep it. It is a real LangGraph StateGraph with six nodes, one conditional edge, one human interrupt, and a MemorySaver checkpointer. It runs twice. The first run takes a real alert, drafts a plan, stops before the fix, and resumes only when a human approves. The second run takes a vague alert, admits low confidence, and escalates without ever drafting a plan. No model is called. The planner is a FakeListLLM, so every run is deterministic. No API key. The shape is what matters, and the shape is production shape.

The story

Arjun is a fresher. He built a single-agent loop on call. It read an alert, asked a model what to do, and ran the answer. It worked on the first alert. It worked on the second. On the third, the model suggested a rollback for an alert that had no numbers in it. The loop ran it. The rollback was wrong, and the team spent an hour putting the deploy back.

He did not throw the agent away. He put a graph around it. The graph parses the alert first, so a numberless alert never reaches the planner. It scores its own confidence, so a low score routes to a human instead of a fix. It stops before anything that changes a system, so a human reads the plan first. And it checkpoints every step, so a crash resumes instead of restarting.

The agent did not get smarter. The system around it got honest. That is this lesson.

Run it as:

When it breaks, I check

One thing to remember

\1Every hop charges rent in milliseconds. The bar below is a worked example for one alert and one question, not a measurement from a live system, but the shape is honest. On the normal path, the human checkpoint is the biggest slice, and the plan is the next biggest. The route edge is the cheapest hop, because it is one function call that reads state. Step through the lesson or switch the scenario and watch the bar change. The reroute path is slower because the human has to read a vague alert. The lost path is the slowest, because triage and diagnose run twice.\2

Change the graph, and watch the bill move

The budget bar above shows three fixed stories. This simulator lets you write your own. It answers one question: how healthy is this graph, and what does a run cost. You set the node count, the retries, the checkpoint writes, and the human review time. Move a slider and watch the health score, the total time, and the verdict change. The numbers are a teaching example, built from the formulas below, not live measurements. The shape is the lesson: the human is the biggest slice of every run, and retries buy health at the price of time.

Alert p95 3100 ms Triage parse the alert Diagnose confidence: high Route? read the score Escalate no fix runs Plan draft the fix Human gate interrupt here Execute rollback Verify p95 420 ms low confidence high confidence State travels with the alert. Every node reads it. Every node writes it. Checkpoint after every node. Interrupt before Execute.
5 nodes

Nodes on the path, counting triage, diagnose, plan, execute, and verify. Three is the smallest honest graph. Eight is a graph with room for a second agent.

0 retries

Extra diagnose passes before the graph gives up and escalates. Zero means one pass and then the branch. Three means the graph tries hard before it asks a human.

2 writes

Checkpoints saved in the verify hop. One is the final state only. Four saves the plan, the approval, and the fix separately.

30 seconds

Seconds a human spends reading the plan at the checkpoint. Zero means nobody reads it, and the gate is decoration. Ninety is a careful read of a risky fix.

Try this: (1) Set the retries to 3. The diagnose hop goes from 380 ms to 950 ms, the trip takes 2,805 ms, and the score rises from 70 to 90. Retries buy health at the price of time. (2) Set the human review to 0. The human hop goes from 900 ms to 0 ms, the trip takes 1,335 ms, and the score falls from 70 to 60. The fast trip is the careless one. The gate is still in the graph, but nobody stands in it. (3) Max everything: 8 nodes, 3 retries, 4 writes, 90 seconds of review. The score hits 100 of 100, and the trip takes 4,763 ms. Full marks, more than twice the time. Now ask whether the extra nodes measure anything new, or the same graph drawn bigger.

Formulas, in plain terms. Diagnose ms = 200 + nodes x 36 + retries x 190. Human ms = review seconds x 30. Verify ms = 40 + writes x 25. Total time = load 40 + triage 120 + diagnose + route 25 + plan 420 + human + execute 260 + verify. Health score = nodes x 8 (capped at 40) + retries x 10 (capped at 20) + writes x 10 (capped at 30) + 10 when the review is 30 seconds or more, else the review seconds divided by 3, rounded down. Model cost is $0.00. The planner is a FakeListLLM, so no model is called and there is no bill. Moving a slider updates the hop timings, the budget bar, and the step panel above.

Lab: build the graph

Do this now, in your own terminal. You will install LangChain and LangGraph, write one file, run it twice, watch the graph stop for a human, and resume it with one command. No model is called. No API key. The planner is a fake model that returns a fixed string, so the run is deterministic. The shape is what matters, and the shape is production shape.

Step 1: make the folder and install LangChain and LangGraph

LangGraph ships with LangChain. Install both in a virtual environment, so the project stays separate from your system Python.

mkdir langgraph-lab && cd langgraph-lab
python3 -m venv venv
./venv/bin/pip install langchain langgraph

Versions used in this build: langchain 1.5.2, langgraph 1.2.24. A newer patch version is fine. If the API moves under you, read the error first. It usually names the new import path.

Step 2: save graph.py

Save this as graph.py. Six nodes, one conditional edge, one interrupt before execute, one MemorySaver checkpointer. Read the comments. Each one names the hop from the diagram above.

"""Lab graph for Lesson 171: a stateful incident-response graph in LangGraph.

Runs on this machine. No model call, no API key. The plan node uses
LangChain's FakeListLLM, which returns a canned string, so every run is
deterministic and the output below is exactly reproducible.

Graph shape:
    START -> triage -> diagnose -> route (conditional edge)
      high confidence -> plan -> [interrupt] -> execute -> verify -> END
      low confidence  -> escalate -> END

The checkpointer is MemorySaver. The interrupt stops the graph before
execute, and the run resumes only when a human sends Command(resume=...).
"""

import re
from typing import TypedDict

from langchain_core.language_models.fake import FakeListLLM
from langgraph.checkpoint.memory import MemorySaver
from langgraph.graph import END, START, StateGraph
from langgraph.types import Command


class IncidentState(TypedDict):
    alert: str
    service: str
    p95: int
    threshold: int
    confidence: str
    diagnosis: str
    route: str
    plan: str
    action: str
    verified: bool
    log: str


def triage(state: IncidentState) -> dict:
    """Pull the numbers out of the alert text. No numbers, no confidence."""
    text = state["alert"]
    p95 = re.search(r"p95 latency (\d+) ms", text)
    threshold = re.search(r"threshold (\d+) ms", text)
    service = re.search(r"(\w+) p95", text)
    return {
        "service": service.group(1) if service else "unknown",
        "p95": int(p95.group(1)) if p95 else 0,
        "threshold": int(threshold.group(1)) if threshold else 0,
    }


def diagnose(state: IncidentState) -> dict:
    """Name the cause, and say how sure we are. Numbers mean confidence."""
    if state["p95"] and state["threshold"] and state["p95"] > state["threshold"]:
        return {
            "confidence": "high",
            "diagnosis": (
                f"{state['service']} p95 is {state['p95']} ms against a "
                f"{state['threshold']} ms threshold after a deploy"
            ),
        }
    return {
        "confidence": "low",
        "diagnosis": "alert has no p95 and no threshold to check against",
    }


def route(state: IncidentState) -> str:
    """Conditional edge. High confidence goes to the plan. Low goes to a human."""
    return "plan" if state["confidence"] == "high" else "escalate"


PLANNER = FakeListLLM(
    responses=[
        "Check the checkout queue depth first. "
        "If p95 stays above 800 ms for 5 minutes, roll back the last deploy. "
        "Compare the deploy diff with the previous version before any rollback."
    ]
)


def plan(state: IncidentState) -> dict:
    """Draft the fix. The planner is a fake model, so the text is fixed."""
    return {"plan": PLANNER.invoke("draft a fix for: " + state["diagnosis"])}


def execute(state: IncidentState) -> dict:
    """Run the fix. Only ever runs after a human approved the plan."""
    return {"action": "rollback to the previous deploy finished"}


def escalate(state: IncidentState) -> dict:
    """Low confidence: no plan, no fix. A human takes the alert."""
    return {"action": "escalated to a human, no fix run"}


def verify(state: IncidentState) -> dict:
    """Check the fix worked, then write the log line. This is the data hop."""
    after = 420
    ok = state["p95"] == 0 or after < state["threshold"]
    return {
        "verified": ok,
        "log": (
            f"{state['service']} p95 after fix: {after} ms "
            f"(threshold {state['threshold']} ms) - verified: {ok}"
        ),
    }


def build_graph():
    graph = StateGraph(IncidentState)
    graph.add_node("triage", triage)
    graph.add_node("diagnose", diagnose)
    graph.add_node("plan", plan)
    graph.add_node("execute", execute)
    graph.add_node("escalate", escalate)
    graph.add_node("verify", verify)
    graph.add_edge(START, "triage")
    graph.add_edge("triage", "diagnose")
    graph.add_conditional_edges("diagnose", route, {"plan": "plan", "escalate": "escalate"})
    graph.add_edge("plan", "execute")
    graph.add_edge("execute", "verify")
    graph.add_edge("verify", END)
    graph.add_edge("escalate", END)
    checkpointer = MemorySaver()
    compiled = graph.compile(
        checkpointer=checkpointer, interrupt_before=["execute"]
    )
    return compiled, checkpointer


def checkpoint_count(checkpointer, config) -> int:
    return len(list(checkpointer.list(config)))


def run_high_confidence(graph, checkpointer):
    config = {"configurable": {"thread_id": "incident-1"}}
    alert = (
        "2026-11-21T09:14:02Z checkout p95 latency 3100 ms, threshold 800 ms\n"
        "2026-11-21T09:14:05Z deploy checkout v2.14.3 finished 09:12:44Z"
    )
    print("=== RUN 1: high-confidence alert ===")
    print("ALERT:", alert.splitlines()[0])
    first = graph.invoke({"alert": alert}, config)
    stopped = graph.get_state(config)
    print("STOPPED BEFORE:", stopped.next)
    print("PLAN DRAFTED:", bool(first.get("plan")))
    print("CHECKPOINTS SO FAR:", checkpoint_count(checkpointer, config))
    resumed = graph.invoke(Command(resume="approved"), config)
    print("ACTION:", resumed["action"])
    print("VERIFIED:", resumed["verified"])
    print("LOG:", resumed["log"])
    print("CHECKPOINTS TOTAL:", checkpoint_count(checkpointer, config))
    print("FINAL STATE: confidence =", resumed["confidence"],
          "| route = plan | verified =", resumed["verified"])
    return {
        "stopped_before_execute": stopped.next == ("execute",),
        "verified": bool(resumed["verified"]),
    }


def run_low_confidence(graph, checkpointer):
    config = {"configurable": {"thread_id": "incident-2"}}
    alert = "something feels slow on checkout, not sure what changed"
    print("=== RUN 2: low-confidence alert ===")
    print("ALERT:", alert)
    final = graph.invoke({"alert": alert}, config)
    print("DIAGNOSIS:", final["diagnosis"])
    print("CONFIDENCE:", final["confidence"])
    print("ACTION:", final["action"])
    print("PLAN DRAFTED:", bool(final.get("plan")))
    print("CHECKPOINTS TOTAL:", checkpoint_count(checkpointer, config))
    return {"no_plan_drafted": not bool(final.get("plan"))}


if __name__ == "__main__":
    compiled_graph, saver = build_graph()
    run1 = run_high_confidence(compiled_graph, saver)
    run2 = run_low_confidence(compiled_graph, saver)
    print("=== CHECKS ===")
    checks = [
        ("graph stopped before execute", run1["stopped_before_execute"]),
        ("fix verified after resume", run1["verified"]),
        ("low-confidence run drafted no plan", run2["no_plan_drafted"]),
    ]
    passed = 0
    for name, ok in checks:
        print(("PASS - " if ok else "FAIL - ") + name)
        passed += 1 if ok else 0
    print(f"{passed}/{len(checks)} checks passed")

Step 3: run it

./venv/bin/python graph.py

Expected output, exactly as it ran in this build:

=== RUN 1: high-confidence alert ===
ALERT: 2026-11-21T09:14:02Z checkout p95 latency 3100 ms, threshold 800 ms
STOPPED BEFORE: ('execute',)
PLAN DRAFTED: True
CHECKPOINTS SO FAR: 5
ACTION: rollback to the previous deploy finished
VERIFIED: True
LOG: checkout p95 after fix: 420 ms (threshold 800 ms) - verified: True
CHECKPOINTS TOTAL: 7
FINAL STATE: confidence = high | route = plan | verified = True
=== RUN 2: low-confidence alert ===
ALERT: something feels slow on checkout, not sure what changed
DIAGNOSIS: alert has no p95 and no threshold to check against
CONFIDENCE: low
ACTION: escalated to a human, no fix run
PLAN DRAFTED: False
CHECKPOINTS TOTAL: 5
=== CHECKS ===
PASS - graph stopped before execute
PASS - fix verified after resume
PASS - low-confidence run drafted no plan
3/3 checks passed

Step 4: read the output, line by line

Three things to notice. First, STOPPED BEFORE: ('execute',). The first invoke did not finish the run. It stopped with execute as the next node, because interrupt_before=["execute"] is a gate, not a comment. The plan was drafted and the fix had not run. Second, the checkpoint counts. Five checkpoints at the interrupt, seven at the end. One per node, plus the interrupt itself. Third, run two. The vague alert never drafts a plan. PLAN DRAFTED: False is the conditional edge doing its job in plain text.

Check yourself

Three outcomes, all checkable in your terminal. ./venv/bin/python graph.py prints STOPPED BEFORE: ('execute',). Run two prints PLAN DRAFTED: False. The last line prints 3/3 checks passed. If any of the three is missing, the graph is not the graph from this lesson. Read the error, fix the file, run it again.

Check yourself

Three questions. No score is saved anywhere — this is just you against the material.

Basic to master

LangGraph is not one thing. It is four levels of the same job, and every team I have worked with sits on one of them. The levels are not about how smart the model is. They are about how much of the run the graph remembers, and how much of it a human can stop. Read them in order. Each level fixes the failure that hurt the most at the level below it.

Basic: One chain, no state, the caller remembers everything

At the basic level, you have a LangChain chain. One step runs, its output feeds the next step, and the chain forgets the rest. The caller holds whatever memory exists, usually in a variable in a script. That is Lesson 170. It works when the run is short and nothing can fail halfway. It breaks the moment a run crashes and has to start over, because there is nothing to resume from.

Uses: A first agent. A demo where you are in the room and a restart costs nothing.

Failure modes: The run crashes at step three and starts from step one. The agent retries the same bad step because it cannot remember the first try. A human cannot stop it, because there is nothing to stop.

Do this: Build the Lesson 170 chain. Then add one dict that you pass by hand from step to step, with the alert and the diagnosis in it. That dict is state, done by hand. The next level makes the graph carry it for you.

Intermediate: One graph, two nodes, state in memory

At the intermediate level, the chain becomes a graph. Two or three nodes, one state object, one checkpointer in memory. The graph remembers what each node did, and a resume loads the state instead of restarting. The interrupt is not here yet. The graph still runs to the end once it starts.

Uses: A triage graph that parses and diagnoses. A run you can resume after a crash, on the same machine.

Failure modes: The checkpointer lives in memory, so a process restart loses it anyway. The graph runs the fix without asking, because there is no gate yet. A low-confidence diagnosis still reaches the planner.

Do this: Build a two-node graph, triage then diagnose, with a MemorySaver checkpointer. Run it, kill the process halfway, and resume the same thread. Show that the second run starts from the checkpoint, not from the top.

Advanced: This lesson: branch on confidence, stop for a human, resume from a checkpoint

At the advanced level, the graph branches. A conditional edge reads confidence from state and picks a path. An interrupt stops the run before anything that changes a system. A human reads the plan and resumes it. This is the lesson you just walked. The graph is small. The guarantees around it are complete.

Uses: The graph from this lab. Any agent that touches a real system, where a wrong action costs more than a slow one.

Failure modes: The interrupt is placed after the node it should guard, so the fix runs before the human reads the plan. The route function reads the alert instead of state, so it disagrees with the diagnosis. The checkpointer is forgotten at compile time, so the resume starts from the top.

Do this: Build the lab graph. Run both alerts. Show the interrupt in the output, show the resume, and show the checkpoint counts. Then remove the interrupt and run it again. The check at the end should fail. That failure is the proof the gate matters.

Master: Multi-agent graph, persistent checkpoints, traces, and evals on the route

At the master level, the graph has more than one agent. A triage agent, a diagnosis agent, and a verify agent share one state object, and the edges between them are the contract. The checkpointer is persistent, on disk or in a database, so a restart loses nothing. Every run is traced in LangSmith, and the route decision has an eval set. Ten alerts, each with an expected route, and the pass rate is on the README. At 10x the traffic, the checkpoint store gets a real database. At 100x, the eval set runs in CI on every push, and a failing route blocks the merge.

Uses: A production agent system. A portfolio piece with two agents, one shared state, and a route eval a stranger can run.

Failure modes: The agents share state but write the same keys, so one overwrites the other. The eval set measures the easy alerts only, and the route looks perfect until a vague alert arrives. The traces pile up and nobody reads them, so the first real failure has no trail.

Do this: Move the checkpointer to disk, add a second agent node that only verifies, and write ten route evals. Run them in CI. Then start the next agent with the same harness, and write down the one trade-off that changes between the two.

The other names you will meet

LangGraph is not the only framework with agents in its name. You will meet three others in job posts, in docs, and in interviews. This section covers all three, so no name in this lesson is new to you. None of them gets its own lesson. Each one is a different answer to the same question, and the question is who decides what happens next.

CrewAI: a crew with job titles

CrewAI organizes agents the way a team is organized. Each agent has a role, a goal, and a backstory. A researcher agent gathers facts. An analyst agent reads them. A writer agent turns them into a report. The crew runs in order, and each agent hands its output to the next one. Pick CrewAI when the work looks like a team with clear roles, and when the handoff between roles matters more than the state between steps. It differs from LangGraph in one place that matters. The crew is the unit. LangGraph has no crew. It has a graph, and the nodes can be anything, including agents with roles. A crew is easy to explain to a hiring manager. A graph is easier to debug at 2 AM, because the state shows every decision in order.

AutoGen: agents that talk to each other

AutoGen organizes agents as a conversation. One agent writes a message. Another replies. A third checks the answer. The work happens in the chat between them, and the conversation is the log. Pick AutoGen when the problem is genuinely conversational, like two agents debating a design or a reviewer agent pushing back on a draft. It differs from LangGraph in where the logic lives. In AutoGen, the logic lives in the messages. In LangGraph, the logic lives in the edges and the state. A conversation is flexible, and that flexibility is also the risk. A message can say anything, so the next step is hard to predict. An edge in a graph can only go where the graph allows, so the next step is written down before the run starts.

LangSmith: the flight recorder for LangChain apps

LangSmith is not an agent framework. It is the observability and evals layer for LangChain and LangGraph apps. It records every run, every model call, every token, and every error, and it lets you replay a run to see what the agent actually did. It also runs evals: give it a set of inputs with expected outputs, and it scores the runs. Pick LangSmith when your graph works and you need to know why it worked, or why it failed on the tenth alert. It differs from LangGraph in the same way a flight recorder differs from a plane. LangGraph flies the run. LangSmith records it. You need both in production, and they are built to work together. The traces from this lesson's graph would land in LangSmith with one line of setup, and the route eval from the Master tier would run there too.

How to pick in one minute

Ask one question. Who decides what happens next. If a human decides, or the decision depends on state the run must remember, pick LangGraph. If a team with fixed roles decides, and the handoffs are the product, pick CrewAI. If a conversation decides, and the back and forth is the work, pick AutoGen. Then, whatever you picked, add LangSmith, because the day the agent does something strange, the trace is the only witness you have. The frameworks are not rivals. They are different shapes for different decisions, and a senior engineer names the shape before naming the tool.

Go deeper

State is the difference

A chain is a line. A graph is a map. The line runs the next step no matter what the last step found. The map reads state and picks a path. That is the whole difference, and it is enough to change what you can build. A chain can answer a question. A graph can triage an alert, decide it is unsure, ask a human, and resume after the answer. The nodes can be the same in both. The state and the edges are what change. If you ever wonder whether you need LangGraph, ask whether the next step depends on what the last step learned. If it does, you need a graph. If it does not, a chain is simpler, and simpler is better.

Checkpoints are the audit trail

MemorySaver holds checkpoints in memory, which is why the lab is fast and why a process restart loses them. In production the checkpointer is persistent. The names to know are PostgresSaver and RedisSaver. The code does not change much. The checkpointer changes, and the resume works across restarts. Read the state by hand with get_state. It shows the values and the next nodes, which is the fastest way to answer the question where did it stop. The lab prints STOPPED BEFORE: ('execute',) from exactly that call. When the incident review asks what happened, the checkpoints answer in order, and the human approval is one of the entries.

The human is a node, not a comment

There are two ways to stop a graph for a human. interrupt_before stops before a node runs, which is what the lab uses. interrupt() inside a node stops in the middle of the node, which fits a human question asked mid-step. Both write a checkpoint first. The resume is Command(resume=...), and the value you pass is the human's decision, available to the next node as state. A prompt that tells the model to wait is not a gate. A model can ignore a prompt. It cannot ignore an interrupt, because the graph does not run the next node until the resume arrives.

Break it on purpose, then fix it

Copy the lab file to graph_nogate.py and remove the interrupt. One change, interrupt_before=[], and run it again.

sed 's/interrupt_before=["execute"]/interrupt_before=[]/' graph.py > graph_nogate.py
./venv/bin/python graph_nogate.py

The output changes in exactly the lines that matter:

STOPPED BEFORE: ()
CHECKPOINTS SO FAR: 7
FAIL - graph stopped before execute
2/3 checks passed

The graph never stopped. The fix ran inside the first invoke, before any human read the plan, and the resume at the end was a no-op. The check at the bottom caught it: 2 of 3, not 3 of 3. That is the check doing its job. A gate you can remove without a test failing is a gate nobody will notice missing. Delete the copy, keep the gate.

Do it yourself: run it from a clean copy

Copy the project folder to a new directory, the way a reviewer would clone it. Then run the one command from the lab. No edits, no fixes, no files from your laptop.

cp -r langgraph-lab /tmp/langgraph-clean
cd /tmp/langgraph-clean
./venv/bin/python graph.py

Expected output: identical to the lab run, ending with 3/3 checks passed. It ran byte-identical in this build. If any line differs in the clean copy, the project is not ready. Fix the repo, not the clean copy. The clean copy is the reviewer. The reviewer does not fix your repo for you.

One time it broke

This one stayed with me because the graph worked in rehearsal and ran the fix twice in the room. Twenty rehearsals, and not one of them restarted the process halfway.

What broke

It was a Tuesday morning. A video interview, second round. The interviewer asked me to share my screen and run the graph. I typed the command I had typed twenty times. The graph drafted the plan, stopped at the interrupt, and waited. I approved it. The fix ran. Then my laptop went to sleep for thirty seconds, the process died, and I resumed the thread to show the checkpoint working. The resume started from the top. Triage ran again. Diagnose ran again. The plan was drafted again. And the fix ran a second time. The rollback ran twice because the first version of my graph had no checkpointer passed to compile. The interrupt had worked. The resume had not, because there was nothing to resume from.

Timeline

What changed after

Three things. First, the checkpointer is passed at compile time, every time, even in a demo. A graph without one is a chain with extra steps. Second, I check state.next before every resume, so I know where the graph stopped instead of assuming. Third, the execute node is idempotent, so a second run of the same fix is a no-op instead of a second rollback. A resume that re-runs a finished node is a resume that lies about what happened. The checkpoint is the fix for that, and the test is a killed process, not a clean stop.

If you remember nothing else

Design exercise

Build a two-agent graph for the same checkout alert. A triage agent parses the alert and writes the facts into state. A verify agent reads the state after the fix and writes the verdict. The two agents share one state object and never write the same keys. A conditional edge routes on confidence. An interrupt stops the graph before any node that changes a system. A MemorySaver checkpointer saves every step. The checkable outcome is the run output: the graph stops before the fix, resumes on approval, and prints 3 of 3 checks passed. Then kill the process mid-run and resume the same thread. The second run must not re-run the fix.

Clarifying questions to ask

Rough sizing, worked

Start with the lab graph. It already has the edge, the interrupt, and the checkpointer. Add the verify agent as a second node that only reads state and writes the verdict, about 40 lines. Split the state keys in two lists, one per agent, and write the lists at the top of the file. Then write the three checks from the lab, plus a fourth: after a killed process and a resume, the fix runs zero additional times. Run the graph twice, once per alert, and once more after killing it. The checkable outcome is four lines of PASS and a checkpoint count that grows by the nodes that actually ran.

Trade-offs to name

Two agents buy a clean split of duties and cost a shared-state contract, so I write the key lists first and I review them before any code. An interrupt before every system change buys safety and costs waiting, so I gate only the nodes that change a system and I leave the readers ungated. A persistent checkpointer buys resumes across restarts and costs a database to run, so I start with MemorySaver and I move to disk when the first resume across a restart matters. A route eval set buys proof and costs maintenance, so I keep ten cases and I prune one every time I add one.

Saved in this browser, so the Lessons index can show your progress across the course.

Next in this series, not built yet
Lesson 172 is still on the bench.

The Phase 5 cloud lessons may follow here, and the integration pass will wire the link when they land. For now, the path ends at this lesson. The whole path is still there. If you want to run it again, start at the beginning, or pick the hop you want to revisit.