AsyncPostgresSaver(
self,
conn: _ainternal.Conn,
pipe: AsyncPipeline | None = None,
serde:BasePostgresSaver| Name | Type |
|---|---|
| conn | _ainternal.Conn |
| pipe | AsyncPipeline | None |
| serde | SerializerProtocol | None |
Asynchronous checkpointer that stores checkpoints in a Postgres database.
Create a new AsyncPostgresSaver instance from a connection string.
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.
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).
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.
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).
Store intermediate writes linked to a checkpoint asynchronously.
This method saves intermediate writes associated with a checkpoint to the database.
Delete all checkpoints and writes associated with a thread ID.
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).
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.
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).
Store intermediate writes linked to a checkpoint.
This method saves intermediate writes associated with a checkpoint to the database.
Delete all checkpoints and writes associated with a thread ID.