User Summary Instructions

Customize how Zep generates entity summaries for users in their knowledge graph

Get started with the example in the video using:

$git clone https://github.com/getzep/zep.git
>cd zep/examples/python/user-summary-instructions-example

Overview

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 SDK reference.

Default instructions

Zep applies the following default instructions to generate user summaries when no custom instructions are specified:

  1. What are the user’s key personal and lifestyle details?
  2. What are the user’s important relationships or social connections?
  3. What does the user do for work, study, or main pursuits?
  4. What are the user’s preferences, values, and recurring goals?
  5. 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().

1from zep_cloud.client import Zep
2from zep_cloud.types import UserInstruction
3
4client = Zep(api_key=API_KEY)
5
6# Add instructions for specific users
7client.user.add_user_summary_instructions(
8 instructions=[
9 UserInstruction(
10 name="professional_background",
11 text="What are the user's key professional skills and career achievements?",
12 )
13 ],
14 user_ids=[user_id],
15)
16
17# Add project-wide default instructions (applied to all users without custom instructions)
18client.user.add_user_summary_instructions(
19 instructions=[
20 UserInstruction(
21 name="communication_style",
22 text="How does the user prefer to receive information and assistance?",
23 )
24 ],
25)
26
27# List instructions for a user
28instructions = client.user.list_user_summary_instructions(user_id=user_id)
29
30# Delete specific instructions for a user
31client.user.delete_user_summary_instructions(
32 instruction_names=["professional_background"],
33 user_ids=[user_id],
34)

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.