langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Support Save and Retrieve Memory from Redis

Open andyxinyuwu opened this issue 1 year ago • 0 comments

Right now to create an agent that has memory, we do memory = ConversationBufferMemory(memory_key=str('chat_history')) Then pass it to the agent agent_executor = AgentExecutor.from_agent_and_tools(agent=agent, tools=tools, verbose=True, memory=memory)

However, the memory will be gone if the server restarts. I learned that memory can be dumped as json, but to avoid losing messages, we have to dump to json every time a message comes in, which is not a good solution.

Can we add support for storing conversation buffer memory in redis and when constructing the agent pass the redis instance to the agent executor?

Let me know if there is an existing solution for this. Appreciate the help!

andyxinyuwu avatar Mar 23 '23 13:03 andyxinyuwu