Overview
Checkpoints enable you to save and restore workflow state, allowing:- Pause and resume: Stop a workflow and continue later
- Fault tolerance: Recover from failures without losing progress
- Long-running workflows: Handle workflows that take hours or days
- State inspection: Debug by examining saved state at any point
How Checkpoints Work
Workflows execute in super steps. A checkpoint is automatically created at the end of each super step, capturing:- Messages: All messages exchanged between executors
- State: Workflow state including user data and executor states
- Pending requests: Any pending request-info events (for human-in-the-loop)
- Iteration count: Current iteration number
- Metadata: Workflow topology and version information

Enabling Checkpointing
Provide aCheckpointStorage when building your workflow:
Checkpoint Storage Backends
In-Memory Storage (Testing)
For development and testing:Python
File Storage (Production)
Persist checkpoints to disk:Python
Security: File storage uses pickle for serialization. Only load checkpoints from trusted sources.
Custom Storage
ImplementCheckpointStorage protocol for custom backends:
Python
Capturing Checkpoints
Checkpoints are created automatically. Listen for checkpoint events:Restoring from Checkpoints
Resume workflow execution from a saved checkpoint:Executor State Persistence
Executors can save and restore internal state across checkpoints:Python
Managing Checkpoints
List Checkpoints
Python
Delete Old Checkpoints
Python
Checkpoint Metadata
Python
Automatic Recovery Pattern
Implement automatic retry with checkpoints:Python
Checkpoint Compatibility
Checkpoints are tied to workflow topology:- Graph signature hash: Validates workflow structure hasn’t changed
- Version: Checkpoint format version
- Workflow name: Logical grouping of checkpoints
Complete Example
Iterative computation with automatic checkpointing:Python
Best Practices
Storage Selection
Storage Selection
- Use InMemoryCheckpointStorage for tests and local development
- Use FileCheckpointStorage for production single-node deployments
- Use custom storage (database, blob storage) for distributed systems
State Management
State Management
- Keep state serializable (primitive types, dataclasses)
- Minimize state size - only persist essential data
- Use executor state hooks (
on_checkpoint_save/restore) for executor-specific state - Avoid storing large objects in workflow state
Checkpoint Lifecycle
Checkpoint Lifecycle
- Implement retention policies (delete old checkpoints)
- Monitor checkpoint storage size
- Test checkpoint restoration regularly
- Document checkpoint compatibility requirements
Error Handling
Error Handling
- Handle checkpoint load failures gracefully
- Validate checkpoint compatibility before restore
- Log checkpoint operations for debugging
- Provide fallback to fresh start if restore fails
Next Steps
Human-in-the-Loop
Combine checkpoints with human input for interactive workflows
Orchestration Patterns
Learn about sequential, concurrent, and conditional execution