SqliteSaver is a checkpoint saver that stores checkpoints in a SQLite database. It provides a lightweight, file-based persistence solution for LangGraph agents.
Overview
SqliteSaver is designed for:- Lightweight, synchronous use cases
- Demos and small projects
- Local development and testing
- Single-threaded applications
Class Definition
langgraph.checkpoint.sqlite.__init__:38
Installation
SqliteSaver is included in the baselanggraph-checkpoint-sqlite package:
Constructor
Parameters
conn(sqlite3.Connection): The SQLite database connectionserde(SerializerProtocol, optional): The serializer for encoding/decoding checkpoints. Defaults toJsonPlusSerializer
langgraph.checkpoint.sqlite.__init__:78
Usage
Basic Setup
Using from_conn_string
Class Methods
from_conn_string
conn_string(str): The SQLite connection string. Use:memory:for in-memory database or a file path for persistent storage
Iterator[SqliteSaver]: A context manager yielding a SqliteSaver instance
langgraph.checkpoint.sqlite.__init__:90
Instance Methods
setup
langgraph.checkpoint.sqlite.__init__:122
get_tuple
config(RunnableConfig): Configuration containingthread_idand optionallycheckpoint_id
CheckpointTuple | None: The checkpoint tuple, or None if not found
langgraph.checkpoint.sqlite.__init__:184
list
config(RunnableConfig | None): Base configuration for filteringfilter(dict[str, Any] | None): Additional metadata filtering criteriabefore(RunnableConfig | None): Only return checkpoints before this checkpoint IDlimit(int | None): Maximum number of checkpoints to return
Iterator[CheckpointTuple]: Iterator of checkpoint tuples, ordered by checkpoint ID (newest first)
langgraph.checkpoint.sqlite.__init__:288
put
config(RunnableConfig): Configuration for the checkpointcheckpoint(Checkpoint): The checkpoint to savemetadata(CheckpointMetadata): Additional metadatanew_versions(ChannelVersions): New channel versions
RunnableConfig: Updated configuration with the new checkpoint ID
langgraph.checkpoint.sqlite.__init__:380
put_writes
config(RunnableConfig): Configuration of the related checkpointwrites(Sequence[tuple[str, Any]]): List of (channel, value) pairs to storetask_id(str): Identifier for the task creating the writestask_path(str): Path of the task (default: "")
langgraph.checkpoint.sqlite.__init__:438
delete_thread
thread_id(str): The thread ID to delete
langgraph.checkpoint.sqlite.__init__:477
get_next_version
current(str | None): The current version identifierchannel(None): Deprecated parameter
str: The next version identifier (format:"{version:032}.{random:016}")
langgraph.checkpoint.sqlite.__init__:537
Database Schema
SqliteSaver creates two tables:checkpoints table
writes table
AsyncSqliteSaver
For async applications, useAsyncSqliteSaver:
langgraph.checkpoint.sqlite.aio:31
Limitations
- Not suitable for production workloads with high concurrency
- Does not scale to multiple threads (use AsyncSqliteSaver or PostgresSaver instead)
- SQLite’s write performance is limited compared to dedicated databases
- File locking can cause issues in distributed environments
See Also
- BaseCheckpointSaver - Base checkpoint interface
- PostgresSaver - PostgreSQL implementation for production
- AsyncSqliteSaver - Async SQLite implementation