CourseAgentic AI Engineer: The Complete Course · Module 8: Memory and State · part 45 of 97
Part 45 · Module 8: Memory and State

Lesson 1: Keeping a run's state safe through a crash

28 min read·
Module 8 · Lesson 1 · About 55 minutes · Needs: Module 5 (Lesson 1, the loop; Lesson 3, the SQLite checkpointer) and the shared data's compact tools (make_tools, run_tool; Module 3 builds their final form)

The situation

It is Tuesday 26 May 2026, week 7. Dev is moving the agent onto a worker that is redeployed twice a day. "Every deploy kills whatever is running. Say the agent is halfway through R-1004: Mei Tanaka cancelling her SoundPod headphones, order 8204, $79.00. What happens when it starts again?"

Marta is sharper: "If the refund went through just before the restart, I do not want it paid twice."

Module 5 saved a run while it waited for a person. This lesson saves it after every turn and makes replaying a turn harmless.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan