Memories
Memories are the central data structure in Zep's Memory Store. They contain a list of Messages and Relevant Facts.
Persisting a Memory to a Session
A Memory may include a single message or a series of messages. Each Message has a role
, role_type
and content
field, with
role being the identifiers for your human and AI/agent users, and content being the text of the message.
Additionally, you can store custom metadata with each Message.
Sessions don’t need to be explicitly created
Sessions are created automatically when adding Memories. If the SessionID
is already exists, then the Memory is
upserted into the Session.
Manually creating a session can be useful if you want to associate it with a user or add metadata.
Python
TypeScript
Retrieving a Session’s Memory
The example below uses Zep’s async API and a context manager.
Python
TypeScript
Sample Output: