LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Graphs
    • Functional API
    • Pregel
    • Checkpointing
    • Storage
    • Caching
    • Types
    • Runtime
    • Config
    • Errors
    • Constants
    • Channels
    • Agents
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewGraphsFunctional APIPregelCheckpointingStorageCachingTypesRuntimeConfigErrorsConstantsChannelsAgents
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    PythonlanggraphCheckpointing

    Checkpointing

    Checkpoints allow LangGraph agents to persist their state within and across multiple interactions. A checkpoint is a snapshot of the graph state at a given point in time, identified by a unique, monotonically increasing ID.

    Learn more: For conceptual guides and tutorials on persistence, see the Persistence documentation.

    Core Concepts

    Concept Description
    Checkpoint Snapshot of graph state at a point in time, including channel values, channel versions, and version tracking per node
    Thread A sequence of checkpoints identified by a unique thread_id; optionally narrow to a specific checkpoint with checkpoint_id
    Serde Serialization protocol used to encode/decode checkpoint data; defaults to JsonPlusSerializer
    Pending writes Writes from successful nodes preserved when other nodes fail, enabling resumption without re-running completed work

    Checkpoint Savers

    LangGraph provides several checkpoint saver implementations:

    Saver Package Async Support Use Case
    InMemorySaver langgraph-checkpoint Yes Debugging and testing only
    SqliteSaver langgraph-checkpoint-sqlite No Lightweight demos and small projects
    AsyncSqliteSaver langgraph-checkpoint-sqlite Yes Async SQLite; not recommended for production
    PostgresSaver langgraph-checkpoint-postgres No Production workloads with full checkpoint history
    AsyncPostgresSaver langgraph-checkpoint-postgres Yes Async production workloads with full checkpoint history

    Quick Examples

    In-Memory (Testing)

    from langgraph.checkpoint.memory import MemorySaver  checkpointer = MemorySaver() graph = builder.compile(checkpointer=checkpointer)

    PostgreSQL (Production)

    from langgraph.checkpoint.postgres import PostgresSaver  with PostgresSaver.from_conn_string("postgresql://user:pass@localhost/db") as checkpointer:  checkpointer.setup()  graph = builder.compile(checkpointer=checkpointer)

    Async PostgreSQL

    from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver  async with AsyncPostgresSaver.from_conn_string("postgresql://user:pass@localhost/db") as checkpointer:  await checkpointer.setup()  graph = builder.compile(checkpointer=checkpointer)

    Serialization

    All checkpoint savers use a serialization protocol to encode and decode checkpoint data. The default serializer is JsonPlusSerializer, which uses ormsgpack with a fallback to an extended JSON format that handles LangChain/LangGraph types, datetimes, enums, and more.

    For sensitive data, wrap any serializer with EncryptedSerializer to encrypt checkpoint contents at rest:

    from langgraph.checkpoint.serde.encrypted import EncryptedSerializer from langgraph.checkpoint.postgres import PostgresSaver  encrypted_serde = EncryptedSerializer.from_pycryptodome_aes(encryption_key) checkpointer = PostgresSaver(conn, serde=encrypted_serde)

    Custom Checkpoint Savers

    Subclass BaseCheckpointSaver and implement the following methods:

    • get_tuple — Retrieve a specific checkpoint
    • list — List checkpoints, optionally filtered
    • put — Store a checkpoint
    • put_writes — Store pending writes
    • delete_thread — Delete all checkpoints for a thread

    For async usage, implement the corresponding async variants (aget_tuple, alist, aput, aput_writes, adelete_thread).

    API Reference

    Classes

    Class

    CheckpointMetadata

    Metadata associated with a checkpoint.

    Class

    BaseCheckpointSaver

    Base class for creating a graph checkpointer.

    Class

    SerializerProtocol

    Protocol for serialization and deserialization of objects.

    Class

    CipherProtocol

    Protocol for encryption and decryption of data.

    Class

    JsonPlusSerializer

    Serializer that uses ormsgpack, with optional fallbacks.

    Class

    EncryptedSerializer

    Serializer that encrypts and decrypts data using an encryption protocol.

    Class

    InMemorySaver

    An in-memory checkpoint saver.

    Class

    PersistentDict

    Persistent dictionary with an API compatible with shelve and anydbm.

    Class

    SqliteSaver

    A checkpoint saver that stores checkpoints in a SQLite database.

    Class

    AsyncSqliteSaver

    An asynchronous checkpoint saver that stores checkpoints in a SQLite database.

    Class

    PostgresSaver

    Checkpointer that stores checkpoints in a Postgres database.

    Class

    AsyncPostgresSaver

    Asynchronous checkpointer that stores checkpoints in a Postgres database.

    Functions

    Function

    create_checkpoint

    Create a checkpoint for the given channels.

    Modules

    Module

    utils

    Module

    aio

    Constants

    Attribute

    Checkpoint

    Attribute

    logger

    Attribute

    MemorySaver

    Attribute

    T