Skip to navigation

User Summary Instructions

Customize how Zep generates entity summaries for users in their Context 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 Context Graph. You can create up to 5 custom instructions for a user or for the project. 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 defaults cover personal details, work, relationships, preferences, goals, and interaction instructions.

Custom instructions

Instructions are managed with set and get methods. A set call replaces the full set of instructions at its scope. Use user.set_summary_instructions with the uuid that user.create returns to set the instructions for one user. Use project.set_user_summary_instructions to set the project-wide defaults. To remove one instruction, write the set again without it.

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 to data ingested through the Batch API.

from zep_cloud.client import Zep
from zep_cloud.types import UserInstruction
client = Zep(api_key=API_KEY)
# zep_user_uuid is the uuid of the user, from your application database.
# Set the instructions for one user. This call replaces the full set for the user.
client.user.set_summary_instructions(
zep_user_uuid,
instructions=[
UserInstruction(
name="professional_background",
text="What are the user's key professional skills and career achievements?",
)
],
)
# Set project-wide default instructions (applied to all users without their own instructions)
client.project.set_user_summary_instructions(
instructions=[
UserInstruction(
name="communication_style",
text="How does the user prefer to receive information and assistance?",
)
],
)
# Get the instructions for a user
instructions = client.user.get_summary_instructions(zep_user_uuid)
# Remove one instruction for a user: write the set again without it.
# Do not write back an inherited set, because that copies the project defaults to the user.
if not instructions.inherited:
remaining = [i for i in instructions.instructions or [] if i.name != "professional_background"]
client.user.set_summary_instructions(zep_user_uuid, instructions=remaining)

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.

You can also retrieve the user node and include its summary in a custom Context Block. The user summary example shows this method.