LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    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

    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph.checkpoint.postgresaioAsyncPostgresSaver
    Classā—Since v1.0

    AsyncPostgresSaver

    Asynchronous checkpointer that stores checkpoints in a Postgres database.

    Copy
    AsyncPostgresSaver(
      self,
      conn: _ainternal.Conn,
      pipe: AsyncPipeline | None = None,
      serde: SerializerProtocol | None = None
    )

    Bases

    BasePostgresSaver

    Constructors

    constructor
    __init__
    NameType
    conn_ainternal.Conn
    pipeAsyncPipeline | None
    serdeSerializerProtocol | None

    Attributes

    attribute
    lock: asyncio.Lock
    attribute
    conn: conn
    attribute
    pipe: pipe
    attribute
    loop
    attribute
    supports_pipeline

    Methods

    method
    from_conn_string

    Create a new AsyncPostgresSaver instance from a connection string.

    method
    setup

    Set up the checkpoint database asynchronously.

    This method creates the necessary tables in the Postgres database if they don't already exist and runs database migrations. It MUST be called directly by the user the first time checkpointer is used.

    method
    alist

    List checkpoints from the database asynchronously.

    This method retrieves a list of checkpoint tuples from the Postgres database based on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).

    method
    aget_tuple

    Get a checkpoint tuple from the database asynchronously.

    This method retrieves a checkpoint tuple from the Postgres database based on the provided config. If the config contains a checkpoint_id key, the checkpoint with the matching thread ID and "checkpoint_id" is retrieved. Otherwise, the latest checkpoint for the given thread ID is retrieved.

    method
    aput

    Save a checkpoint to the database asynchronously.

    This method saves a checkpoint to the Postgres database. The checkpoint is associated with the provided config and its parent config (if any).

    method
    aput_writes

    Store intermediate writes linked to a checkpoint asynchronously.

    This method saves intermediate writes associated with a checkpoint to the database.

    method
    adelete_thread

    Delete all checkpoints and writes associated with a thread ID.

    method
    aget_delta_channel_history

    Fast-path override of BaseCheckpointSaver.aget_delta_channel_history.

    See PostgresSaver.get_delta_channel_history for design notes; this is the async equivalent with internal stage-1 paging and per-channel UNION ALL stage-2.

    method
    list

    List checkpoints from the database.

    This method retrieves a list of checkpoint tuples from the Postgres database based on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).

    method
    get_tuple

    Get a checkpoint tuple from the database.

    This method retrieves a checkpoint tuple from the Postgres database based on the provided config. If the config contains a checkpoint_id key, the checkpoint with the matching thread ID and "checkpoint_id" is retrieved. Otherwise, the latest checkpoint for the given thread ID is retrieved.

    method
    put

    Save a checkpoint to the database.

    This method saves a checkpoint to the Postgres database. The checkpoint is associated with the provided config and its parent config (if any).

    method
    put_writes

    Store intermediate writes linked to a checkpoint.

    This method saves intermediate writes associated with a checkpoint to the database.

    method
    delete_thread

    Delete all checkpoints and writes associated with a thread ID.

    Inherited fromBasePostgresSaver

    Attributes

    ASELECT_SQL: SELECT_SQLASELECT_PENDING_SENDS_SQL: SELECT_PENDING_SENDS_SQLAMIGRATIONS: MIGRATIONSAUPSERT_CHECKPOINT_BLOBS_SQL: UPSERT_CHECKPOINT_BLOBS_SQLAUPSERT_CHECKPOINTS_SQL: UPSERT_CHECKPOINTS_SQLAUPSERT_CHECKPOINT_WRITES_SQL: UPSERT_CHECKPOINT_WRITES_SQLAINSERT_CHECKPOINT_WRITES_SQL: INSERT_CHECKPOINT_WRITES_SQL

    Methods

    Mget_next_version
    View source on GitHub