What checkpointing provides
Checkpoints are saved to a thread, identified by a uniquethread_id. This enables:
- Memory: Maintain context between interactions in conversations
- Human-in-the-loop: Inspect, interrupt, and approve graph steps
- Time travel: Replay prior executions and debug specific steps
- Fault tolerance: Resume from the last successful step after failures
Set up checkpointing
Navigate to the checkpointing step
During agent creation or editing, navigate to the Checkpointing step in the agent form.
Choose a backend
Select the checkpointing backend that matches your deployment needs. See the sections below for details on each option.
Fill in connection details
Enter the required configuration for your chosen backend (file path for SQLite, connection string for PostgreSQL).
Checkpointing backends
In-memory
TheInMemorySaver stores checkpoints in the application’s memory. This is the default option with no external dependencies.
| Property | Detail |
|---|---|
| Persistence | None. Data is lost when the application restarts. |
| Performance | Fastest option, no I/O overhead. |
| Use cases | Development, testing, stateless workflows. |
SQLite
TheSqliteSaver uses a file-based SQLite database to store checkpoints.
| Property | Detail |
|---|---|
| Persistence | Data persists on disk in a single file. |
| Performance | Fast for single-process applications. |
| Concurrency | Limited to single-writer scenarios. |
| Use cases | Local development, small-scale applications. |
PostgreSQL
ThePostgresSaver uses PostgreSQL for checkpoint storage. This is the recommended backend for production deployments.
| Property | Detail |
|---|---|
| Persistence | Production-grade database storage. |
| Performance | Optimized for multi-process and concurrent access. |
| Scalability | Supports multiple agent instances. |
| Use cases | Production deployments, multi-instance setups. |
Threads and state
Threads
A thread is a unique identifier (thread_id) that groups related checkpoints together. Each conversation or interaction should use a unique thread_id to maintain isolation between sessions.
When invoking a graph with a checkpointer, you must specify a thread_id:
State snapshots
Each checkpoint contains aStateSnapshot with:
- values: The state channel values at that point in time
- config: Configuration associated with the checkpoint
- metadata: Additional metadata about the checkpoint
- next: Nodes to execute next in the graph
graph.get_state(config).
Best practices
- Use SQLite for local development: No server setup required, file-based storage
- Use PostgreSQL for production: Multi-process support, reliability, and scalability
- Use in-memory for testing: Fastest option for stateless testing scenarios
- Configure thread isolation: Each conversation should have a unique
thread_id - Monitor checkpoint storage: Long-running conversations can accumulate significant state
Troubleshooting
- Verify database connection: Test the connection string independently before configuring
- Check permissions: Confirm the agent has read/write access to the database or file system
- Thread ID required: Always provide a
thread_idin the config when using checkpointers - Database schema: PostgreSQL checkpointers automatically create required tables on first use
- Review logs: Check agent logs for checkpoint-related errors