Implementing persistence / checkpointers in streamlit UI #112
-
Hi, I'm working with one langgraph model that I am able to successfully implement into streamlit. However, the model has no memory. The only memory related code I have is I was wondering if someone could explain the structure/logic behind how memory is implemented in your package? Like this portion -- I've tried just using one arbitrary id number like 1 in my threads but that fails too. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey, you probably need to store the MemorySaver() in st.session_state and re-use it across runs instead of declaring it as its own variable, since Streamlit will re-create it on each run with the code you shared. Fair warning, you may run into some further issues. LangChain / LangGraph and Streamlit don't always play nice together when running in the same process. Hence why I split out the architecture in this repo. I won't be able to provide more support on your use case but the Streamlit forums or LangGraph discussions might be a good place to ask further questions! |
Beta Was this translation helpful? Give feedback.
Hey, you probably need to store the MemorySaver() in st.session_state and re-use it across runs instead of declaring it as its own variable, since Streamlit will re-create it on each run with the code you shared.
Fair warning, you may run into some further issues. LangChain / LangGraph and Streamlit don't always play nice together when running in the same process. Hence why I split out the architecture in this repo.
I won't be able to provide more support on your use case but the Streamlit forums or LangGraph discussions might be a good place to ask further questions!