Step-by-step answer
Core 90 min7 stepsBuild a toy durable execution engine
A durable execution engine in under 200 lines of standard-library Python. Steps are journaled in SQLite by (run_id, seq); a rerun replays recorded results and executes only what never completed; retries back off exponentially, fatal errors stop the run, and replaying a different step or input raises NonDeterminismError. A simulation of the completion workflow shows a crash after step 5 wasting 95 cents of model calls without the journal and nothing with it.
Back to the exercise