Quick Start
How It Works
Basic Resume
With Checkpoints
Manual Checkpoints
List Sessions
Best Practices
Keep the session_id stable across restarts
Keep the session_id stable across restarts
resume() finds prior state by session_id. Store the ID (env var, queue message, or DB row) so a restarted process reopens the right session.Tune checkpoint_interval to task length
Tune checkpoint_interval to task length
Frequent checkpoints cost writes but lose less on failure. For step-heavy tasks, a small interval like
checkpoint_interval=5 balances safety and overhead.Save state at natural boundaries
Save state at natural boundaries
Call
session.save_state({...}) after a meaningful unit of work so session.restore_state() reopens at a clean point when the same session_id resumes.List sessions to reconcile state
List sessions to reconcile state
Session.list_all(persistence=...) shows every stored session and its status — useful for dashboards and cleanup jobs.Related
Session Module
Session API reference
Checkpoints
Checkpoint API

