Skip to content

Commit

Permalink
checkpoint postgres: add a shallow checkpointer (#2826)
Browse files Browse the repository at this point in the history
This PR adds a "shallow" version of `PostgresSaver` checkpointer that
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.
  • Loading branch information
vbarda authored Dec 20, 2024
1 parent 1de61f6 commit 44ee019
Show file tree
Hide file tree
Showing 14 changed files with 4,331 additions and 1,091 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
)
from langgraph.checkpoint.postgres import _internal
from langgraph.checkpoint.postgres.base import BasePostgresSaver
from langgraph.checkpoint.postgres.shallow import ShallowPostgresSaver
from langgraph.checkpoint.serde.base import SerializerProtocol

Conn = _internal.Conn # For backward compatibility
Expand Down Expand Up @@ -396,4 +397,4 @@ def _cursor(self, *, pipeline: bool = False) -> Iterator[Cursor[DictRow]]:
yield cur


__all__ = ["PostgresSaver", "BasePostgresSaver", "Conn"]
__all__ = ["PostgresSaver", "BasePostgresSaver", "ShallowPostgresSaver", "Conn"]
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
)
from langgraph.checkpoint.postgres import _ainternal
from langgraph.checkpoint.postgres.base import BasePostgresSaver
from langgraph.checkpoint.postgres.shallow import AsyncShallowPostgresSaver
from langgraph.checkpoint.serde.base import SerializerProtocol

Conn = _ainternal.Conn # For backward compatibility
Expand Down Expand Up @@ -464,4 +465,4 @@ def put_writes(
).result()


__all__ = ["AsyncPostgresSaver", "Conn"]
__all__ = ["AsyncPostgresSaver", "AsyncShallowPostgresSaver", "Conn"]
Loading

0 comments on commit 44ee019

Please sign in to comment.