Agent memory
An agent can fail a later task when it cannot retrieve information from previous conversations, user activity, or changes in preferences. Agent memory keeps this user-owned context in a temporal Context Graph.
User and thread model
A Zep user owns a user Context Graph. Threads group conversations for that user. Messages and user business data become episodes in the graph.
Use:
- A Zep user for context that belongs to one application user. Store the user
uuidandgraph_uuidnext to your user ID. - A Zep thread for a conversation or workflow that belongs to that user. Store the thread
uuidnext to your conversation ID. thread.get_contextto retrieve a Context Block for the next model request.
Implementation path
Create a thread and add messages
Create one thread for the conversation, and store its UUID. Add each user and assistant message after the application receives or produces it.
Add user business data
Add activity, preferences, or records to the user graph (the user graph_uuid) when that data belongs to the user.
Retrieve user context
Call thread.get_context before the next model request and place the returned Context Block in the correct provider input. For complex tasks, give the agent tools that search the user graph with its graph_uuid pinned. See Build an Agent with Zep.
Start with the Agent memory quickstart. Then read Memory security best practices for provider-specific placement rules.
Boundaries
Agent memory provides context from prior interactions and activity. Agent memory does not guarantee model behavior or authorize an external action. Your application must control tool permissions and action authorization.