langgraph/how-tos/cross-thread-persistence/ #2086
Replies: 4 comments 1 reply
-
It's better if we can store this Memory in such as local file. I use a .py file and with this code, every time i run the .py the memory gets initialized so I lost the information stored in previous runs ! |
Beta Was this translation helpful? Give feedback.
-
Hello, I think you are getting this behaviour because the memory store used here is InMemoryStore. This means that every time you rerun, the memory would initiate from scratch, losing all previous information. If you want to have real persistence, I believe the appropriate way of implementing this right now would be with PostgresStore. This would allow you to setup a Postgres where you could connect every time you rerun your graph. Remember these are just examples for testing purposes, not for production environments. Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Thanks @cividanieltorres , is There Any Tuto to use PostgresStore with LangGraph ? |
Beta Was this translation helpful? Give feedback.
-
Why Can't this be just a node in graph that queries the db and loads the user data into State? |
Beta Was this translation helpful? Give feedback.
-
langgraph/how-tos/cross-thread-persistence/
Build language agents as graphs
https://langchain-ai.github.io/langgraph/how-tos/cross-thread-persistence/?ref=blog.langchain.dev
Beta Was this translation helpful? Give feedback.
All reactions