What's the proper way to use memory with langgraph? #352
Replies: 5 comments 3 replies
-
I am also curious about what is (if any) the official recommendation for the memory for agents created with langgraph, but while waiting for that I have implemented it for myself by using the LangChain memory methods, see https://python.langchain.com/docs/modules/memory/types/buffer/ Basically when building the prompt I read out the memory with It is rather simple actually. |
Beta Was this translation helpful? Give feedback.
-
@XiaoConstantine did you find solution? |
Beta Was this translation helpful? Give feedback.
-
I ends up doing the similar thing like @zoltan-fedor proposed. I don't think current langgraph API accept the memories yet? Maybe someone has better understanding can chime in |
Beta Was this translation helpful? Give feedback.
-
Hi all - in LangGraph, memory is just checkpointing/persistence (see, e.g., the tutorial) - no need for other memory classes. All you have to do is This is much more powerful than LangChain's older forms of chat memory for a couple of reasons:
|
Beta Was this translation helpful? Give feedback.
-
In my mind those two - the conversation message memory (history) and the graph state checkpointing serve different purposes. Typically the graph state represents a single execution of the graph - which is basically one message from user and how that message is handled by the agent. The message memory though stores the message history of the given chat discussion - where each message from the user was handled by a graph execution. |
Beta Was this translation helpful? Give feedback.
-
Context:
When trying this example:
agent executor-force tool
I seems that the
AgentExectuor
doesn't work with langgraph out of the box, specifically:If i use this
agent_executor
as runnable for the subsequent calls, I will get:Where directly use
agent
works fine. It seems to me that AgentExecutor provides API for user to provide memory to keep track of all the messages happening within this agent, e.g.Since the agent executor doesn't work, what's the proper way to have memory along with the langgraph app?
Beta Was this translation helpful? Give feedback.
All reactions