Memories are the central data structure in Zep's Memory Store. They contain a list of Messages and a Summary.
A Memory is the central data structure in Zep’s Memory Store. It contains a list of Messages and a Summary (if created).
The Memory and Summary are returned with UUIDs, token counts, timestamps, and other metadata. Memories are associated with Sessions in a many-to-one relationship.
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
Getting a Session’s Memory
Perpetual Memory
The example below uses Zep’s async API and a context manager.