Lesson 29 / 29

Revision: Cheat Sheet and Self-Check

Review the key ideas of the whole course.

Cheat sheet

Model: StateGraph(State); nodes return partial updates; reducers (operator.add, add_messages) accumulate; compile() gives an app with invoke/stream. Flow: conditional edges for routing, loops with a termination rule and a cap, recursion_limit as the safety net, Command(update, goto) for dynamic hand-offs, Send for parallel map-reduce. Agents: model node ↔ tools node loop; validate tool names and arguments; narrow, well-documented tools with recoverable errors; step, token, time and cost limits. Memory: checkpointer + thread_id (short-term), store with namespaces (long-term), state history for replay and time travel, trim and summarise long histories. Control: interrupt() + Command(resume=...) need a checkpointer; RetryPolicy for transient errors; stream modes updates, values, messages, custom. Multi-agent: start with one agent; supervisor, hand-offs (guard against ping-pong), sub-graphs and hierarchies; they cost more. Ship: scripted-model tests, outcome + trajectory + safety evaluation, durable checkpointer, tracing with redaction, least privilege, approvals, kill switch.

Quick check: Two parallel nodes both write to the same state key in one step. What do you need?

  • A bigger model
  • A reducer that defines how to merge the updates
  • A new checkpointer
  • Nothing, it always works
Answer

A reducer that defines how to merge the updates — Without a reducer, concurrent writes to one key conflict.

Quick check: Your agent sometimes loops forever calling the same tool. Which combination helps most?

  • Removing the checkpointer
  • A higher temperature
  • More tools
  • A step cap in state, a recursion limit, and a clear stop condition
Answer

A step cap in state, a recursion limit, and a clear stop condition — Layered limits bound the loop even when the model never stops.

Quick check: What lets a paused interrupt survive a server restart?

  • A durable checkpointer storing the thread state
  • Keeping the process in memory only
  • A larger context window
  • A faster GPU
Answer

A durable checkpointer storing the thread state — The saved checkpoint is what is resumed later, even by another process.