-
Hi, I'm currently building a LangGraph container using the CLI. Everything works well alongside Redis and PostgreSQL containers. However, after redeploying the stack, I sometimes lose my checkpoints — even though I haven’t touched the PostgreSQL volume. I'm unsure whether I'm managing checkpointing correctly with LangGraph Server in Docker. Currently, I'm using: checkpointer = MemorySaver()
graph = workflow.compile(checkpointer=checkpointer) Does this store checkpoints in the PostgreSQL container at all? Should I instead just use: graph = workflow.compile() Or would it be better to explicitly use a Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi @BoyPit, thanks for writing in. The LangGraph API actually ignores any custom If you want to point to another custom Postgres instance instead of the default, simply set the export POSTGRES_URI="postgresql://user:pass@postgres:5432/mydb" More details here: https://langchain-ai.github.io/langgraph/cloud/reference/env_var/?h=environ#postgres_uri_custom With that in place, LangGraph Server will persist all checkpoints into your Postgres volume and they’ll survive container restarts. Note that "MemorySaver" is an "In memory" implementation of the checkpointer interface, meaning that if we were to actually use your code as-is, nothing would actually be persisted. This is why we frequently sayh to use the in-memory saver only for testing & debugging purposes example: here ![]() |
Beta Was this translation helpful? Give feedback.
-
@hinthornw Is there any alternative to this? |
Beta Was this translation helpful? Give feedback.
-
I am using pants and when I am trying to deserialise the checkpointer, I am losing
|
Beta Was this translation helpful? Give feedback.
Hi @BoyPit, thanks for writing in. The LangGraph API actually ignores any custom
checkpointer
when you’re running on LangGraph Server (Docker or Cloud). I'd recommend dropping thecheckpointer=MemorySaver()
argument and just using the built-in postgres checkpointer that ships with the platform (by compiling with no argsgraph = workflow.compile()
)If you want to point to another custom Postgres instance instead of the default, simply set the
POSTGRES_URI
environment variable before you start the server:More details here: https://langchain-ai.github.io/langgraph/cloud/reference/env_var/?h=environ#postgres_uri_custom
With tha…