Agent memory

Give an agent context from previous interactions and activity

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:

  • user_id for context that belongs to one application user.
  • thread_id for a conversation or workflow that belongs to that user.
  • thread.get_user_context to retrieve a Context Block for the next model request.

Implementation path

1

Create a Zep user

Create one Zep user for each application user whose context must persist.

2

Create a thread and add messages

Use a stable thread_id for the conversation. Add each user and assistant message after the application receives or produces it.

3

Add user business data

Add activity, preferences, or records with user_id when that data belongs to the user.

4

Retrieve user context

Call thread.get_user_context before the next model request and place the returned Context Block in the correct provider input.

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.