ShallowPostgresSaver(
self,
conn: _internal.Conn,
pipe: Pipeline | None = None,
serde: SerializerProtocolBasePostgresSaver| Name | Type |
|---|---|
| conn | _internal.Conn |
| pipe | Pipeline | None |
| serde | SerializerProtocol | None |
A checkpoint saver that uses Postgres to store checkpoints.
This checkpointer ONLY stores the most recent checkpoint and does NOT retain any history. It is meant to be a light-weight drop-in replacement for the PostgresSaver that supports most of the LangGraph persistence functionality with the exception of time travel.
Create a new ShallowPostgresSaver 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.
This method retrieves a list of checkpoint tuples from the Postgres database based on the provided config. For ShallowPostgresSaver, this method returns a list with ONLY the most recent checkpoint.
Get a checkpoint tuple from the database.
This method retrieves a checkpoint tuple from the Postgres database based on the provided config (matching the thread ID in the config).
Save a checkpoint to the database.
This method saves a checkpoint to the Postgres database. The checkpoint is associated with the provided config. For ShallowPostgresSaver, this method saves ONLY the most recent checkpoint and overwrites a previous checkpoint, if it exists.
Store intermediate writes linked to a checkpoint.
This method saves intermediate writes associated with a checkpoint to the Postgres database.