Phase 14: Agent Engineering

Stateful Graph Orchestration — Durable Execution and Checkpoints

Agent is a state machine; nodes are functions; edges are transitions; state is checkpointed after each node. Resume from any failure at the last successful checkpoint. LangGraph is the 2026 reference for this model of low-level stateful orchestration. Describe LangGraph's core model: state machine with typed state, function nodes, conditional edges, and post-node checkpoints. Name the four capabilities the docs highlight: durable execution, streaming, human-in-the-loop, comprehensive memory. Explain the three orchestration topologies LangGraph supports: supervisor, peer-to-peer (swarm), hierarchical (nested subgraphs). Implement a stdlib state graph with typed state, conditional edges, and a checkpoint/resume cycle. Agents and workflows share a problem: when a 40-step run fails at step 38, you want to resume from step 38, not start over. Second-class state models leave operators hacking retries around a library that assumes fresh runs. LangGraph's design answer: state is a first-class typed object, mutations are explicit, and checkpoints persist after every node. Resume is a loadstate(sessionid) call. A graph is defined by: State type. A typed dict (or Pydantic model) that every node reads and mutates. Nodes. Pure functions (state) -> stateupdate. Updates are merged into state after return. Edges. Conditional or direct transitions between nodes. Entry and exit. START and END sentinel nodes mark the boundary. Example: an agent with classify, refund, bug, sales, done nodes — a routing workflow as…

Stateful Graph Orchestration — Durable Execution and Checkpoints: Agent is a state machine; nodes are functions; edges are transitions; state is checkpointed…

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.