Users
Overview
A User represents an individual interacting with your application. Each User can have multiple Threads associated with them, allowing you to track and manage their interactions over time. Additionally, each user has an associated User Graph which stores the memory for that user.
The unique identifier for each user is their UserID. This can be any string value, such as a username, email address, or UUID.
In the following sections, you will learn how to manage Users and their associated Threads.
Users Enable Simple User Privacy Management
Deleting a User will delete all Threads and thread artifacts associated with that User with a single API call, making it easy to handle Right To Be Forgotten requests.
Ensuring Your User Data Is Correctly Mapped to the Zep Knowledge Graph
Adding your userβs email, first_name, and last_name ensures that chat messages and business data are correctly mapped to the user node in the Zep knowledge graph.
For e.g., if business data contains your userβs email address, it will be related directly to the user node.
You can associate rich business context with a User:
user_id: A unique identifier of the user that maps to your internal User ID.email: The userβs email.first_name: The userβs first name.last_name: The userβs last name.
Adding a User
You can add a new user by providing the user details.
Learn how to associate Threads with Users
User Summary Instructions
Get started with the example in the video using:
User summary instructions customize how Zep generates the entity summary for each user in their knowledge graph. You can create up to 5 custom instructions per user, set of users, or project-wide. Each instruction consists of a name (unique identifier) and text (the instruction content, maximum 100 characters).
User summary and the user node
Each user has a single unique user node in their graph representing the user themselves. The user summary generated from these instructions lives on this user node. You can retrieve the user node and its summary using the get_node method shown in the Get the User Node section.
Default instructions
Zep applies the following default instructions to generate user summaries when no custom instructions are specified:
- What are the userβs key personal and lifestyle details?
- What are the userβs important relationships or social connections?
- What does the user do for work, study, or main pursuits?
- What are the userβs preferences, values, and recurring goals?
- What procedural or interaction instructions has the user given for how the AI should assist them?
These default instructions ensure comprehensive user summaries that capture essential information across personal, professional, and interaction contexts.
Custom instructions
Instructions are managed through dedicated methods that allow you to add, list, and delete them. You can apply instructions to specific users by providing user IDs, or set them as project-wide defaults by omitting user IDs.
Best practices for writing instructions: Instructions should be focused and specific, designed to elicit responses that can be answered in a sentence or two. Phrasing instructions as questions is often an effective way to get accurate and succinct responses.
User summary instructions do not apply when using graph.add_batch() or thread.add_messages_batch().
Utilizing user summary
User summaries are automatically included in Zepβs Context Block. You can toggle whether the user summary is included in the Context Block on the Projects page of the web app. Accounts created before November 10, 2025 will need to enable this setting manually, while new accounts have it enabled by default.
Alternatively, you can build a custom context block by retrieving the user node and including its summary. See this example for a complete implementation.
Getting a User
You can retrieve a user by their ID.
Updating a User
You can update a userβs details by providing the updated user details.
Deleting a User
You can delete a user by their ID.
Getting a Userβs Threads
You can retrieve all Threads for a user by their ID.
Listing Users
You can list all users, with optional limit and cursor parameters for pagination.
Get the User Node
You can also retrieve the userβs node from their graph:
The user node might be used to get a summary of the user or to get facts related to the user (see βHow to find facts relevant to a specific nodeβ).
Default Ontology for Users
User graphs utilize Zepβs default ontology, consisting of default entity types and default edge types that affect how the graph is built. You can read more about default and custom graph ontology here.
Definition
Each user graph comes with default entity and edge types that help classify and structure information extracted from conversations. View the full default ontology definition.
Disabling Default Ontology
You can disable the default entity and edge types for specific users if you need precise control over your graph structure. Learn how to disable the default ontology.