Persistence (Long-term Memory)

I have a goal of implementing a very simple graph (e.g., chatbot) with the built-in long-term memory feature and a simple UI without using the LangGraph Platform Cloud SaaS and without the need for Redis which means no standalone Docker.

Is there a way I can self-host the graph while preserving its long-term memory features by using a self-hosted Postgres?
I have read “Overview” and I have followed the memory.ipynb under “agents-from-scratch/notebooks at main · langchain-ai/agents-from-scratch · GitHub” but I still don’t understand how I can self-host a graph with long-term memory features without using the LangGraph Platform. I can however make this work locally (langgraph dev) or LangGraph Platform Cloud SaaS.

I would be pleased if you could guide on which parts of the LangGraph Memory docs I need to follow for my use case and which ones I need to manually code and connect to a self-hosted Postgres, if Redis is not a must. Thanks.

1 Like

I think you might be looking for the PostgresSaver class (docs here). This is also a good blog post that takes it one step further with pgvector to give you the semantic search capabilities you’ll probably want in your chatbot application at some point.

2 Likes