Memory Type | What is Stored | Human Example | Agent Example |
---|---|---|---|
Semantic | Facts | Things I learned in school | Facts about a user |
Episodic | Experiences | Things I did | Past agent actions |
Procedural | Instructions | Instincts or motor skills | Agent system prompt |
Store
currently supports both semantic search and filtering by content.
Finally, using a collection of memories can make it challenging to provide comprehensive context to the model. While individual memories may follow a specific schema, this structure might not capture the full context or relationships between memories. As a result, when using these memories to generate responses, the model may lack important contextual information that would be more readily available in a unified profile approach.
namespace
(similar to a folder) and a distinct key
(like a file name).
Namespaces often include user or org IDs or other labels that makes it easier to organize information.
This structure enables hierarchical organization of memories. Cross-namespace searching is then supported through content filters.
InMemoryStore
is a store that stores data in memory. In a production setting, you would typically use a database or other persistent storage. Please review the store documentation for more options. If you’re deploying with LangGraph Platform, the platform will provide a production-ready store for you.put
method. Please see the BaseStore.put API reference for more details.users
namespace to group user data.get
method is used to retrieve data from the store. The first argument is the namespace, and the second argument is the key. This will return a StoreValue
object, which contains the value and metadata about the value.store
is passed to the agent. This enables the agent to access the store when running tools. You can also use the store from the config to access it from anywhere in your code.InMemoryStore
is a store that stores data in memory. In a production setting, you would typically use a database or other persistent storage. Please review the store documentation for more options. If you’re deploying with LangGraph Platform, the platform will provide a production-ready store for you.UserInfo
schema defines the structure of the user information. The LLM will use this to format the response according to the schema.saveUserInfo
function is a tool that allows an agent to update user information. This could be useful for a chat application where the user wants to update their profile information.put
method is used to store data in the store. The first argument is the namespace, and the second argument is the key. This will store the user information in the store.userId
is passed in the config. This is used to identify the user whose information is being updated.