Users and User Graphs

Understanding user management and knowledge graph integration in Zep

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 context for that user.

Users

The unique identifier for each user is their UserID. This can be any string value, such as a username, email address, or UUID.

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 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 example, 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.

User Graphs

Each user has an associated User Graph that stores their context across all threads. This graph-based context system provides several important capabilities:

Cross-Thread Context Integration

The knowledge graph does not separate the data from different threads, but integrates the data together to create a unified picture of the user. So the thread.get_user_context method doesn’t return context derived only from that thread, but instead returns whatever user-level context is most relevant to that thread, based on the thread’s most recent messages.

This means that insights and information learned in one conversation thread are automatically available in all other threads for the same user, creating a coherent and continuous context experience.

Privacy and RTBF Capabilities

When you delete a user, all associated data is removed:

  • All threads belonging to that user
  • All thread artifacts (messages, metadata)
  • The entire user graph and all knowledge extracted from conversations

This single-operation approach makes it simple to handle Right To Be Forgotten (RTBF) requests and comply with privacy regulations.

Default Ontology for User Graphs

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 in the Customizing Graph Structure guide.

Each user graph comes with default entity and edge types that help classify and structure information extracted from conversations. You can also disable the default entity and edge types for specific users if you need precise control over your graph structure.

The User Node

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 user summary instructions lives on this user node. You can retrieve the user node and its summary using the get_node method described in the SDK reference.

The user node serves as a central hub in the knowledge graph, connecting all information about that user. It stores a high-level summary of the user that can be customized through User Summary Instructions.

Next Steps

Now that you understand how Users and User Graphs work together, you can: