For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
PlaygroundDiscordStatusDashboardSign Up >
DocumentationSDK ReferenceGraphiti
DocumentationSDK ReferenceGraphiti
  • Getting Started
    • Coding with LLMs
    • Key Concepts
    • Quickstart
    • Building an Agent Walkthrough
    • Memory
    • Projects
    • Users
    • Sessions
    • Groups
  • Working with the Graph
    • Understanding the Graph
    • Utilizing Facts and Summaries
    • Customizing Graph Structure
    • Adding Data to the Graph
    • Reading Data from the Graph
    • Searching the Graph
    • Deleting Data from the Graph
    • Debugging
  • Cookbook
    • Check Data Ingestion Status
    • Customize Your Memory Context String
    • Add User Specific Business Data to User Graphs
    • Share Memory Across Users Using Group Graphs
    • Get Most Relevant Facts for an Arbitrary Query
    • Find Facts Relevant to a Specific Node
  • Best Practices
    • Performance Best Practices
    • Adding JSON Best Practices
  • Ecosystem
    • LangGraph
    • Autogen
  • Migrations
    • February 2026 Deprecation Wave
    • Migrate from Mem0
  • FAQ
    • Frequently Asked Questions
  • Legal
    • Privacy Policy
    • Terms of Service
    • Website Terms of Use
LogoLogo
PlaygroundDiscordStatusDashboardSign Up >
Cookbook

Find Facts Relevant to a Specific Node

Was this page helpful?
Previous

Performance Optimization Guide

Next
Built with

Below, we will go through how to retrieve facts which are related to a specific node in a Zep knowledge graph. First, we will go through some methods for determining the UUID of the node you are interested in. Then, we will go through some methods for retrieving the facts related to that node.

If you are interested in the user’s node specifically, we have a convenience method that returns the user’s node which includes the UUID.

An easy way to determine the UUID for other nodes is to use the graph explorer in the Zep Web app.

You can also programmatically retrieve all the nodes for a given user using our get nodes by user API, and then manually examine the nodes and take note of the UUID of the node of interest:

1# Initialize the Zep client
2zep_client = AsyncZep(api_key=API_KEY)
3nodes = await zep_client.graph.node.get_by_user_id(user_id="some user ID")
4print(nodes)
1center_node_uuid = "your chosen center node UUID"

Lastly, if your user has a lot of nodes to look through, you can narrow down the search by only looking at the nodes relevant to a specific query, using our graph search API:

1results = await zep_client.graph.search(
2 user_id="some user ID",
3 query="shoe", # To help narrow down the nodes you have to manually search
4 scope="nodes"
5)
6relevant_nodes = results.nodes
7print(relevant_nodes)
1center_node_uuid = "your chosen center node UUID"

The most straightforward way to get facts related to your node is to retrieve all facts that are connected to your chosen node using the get edges by user API:

1edges = await zep_client.graph.edge.get_by_user_id(user_id="some user ID")
2connected_edges = [edge for edge in edges if edge.source_node_uuid == center_node_uuid or edge.target_node_uuid == center_node_uuid]
3relevant_facts = [edge.fact for edge in connected_edges]

You can also retrieve facts relevant to your node by using the graph search API with the node distance re-ranker:

1results = await zep_client.graph.search(
2 user_id="some user ID",
3 query="some query",
4 reranker="node_distance",
5 center_node_uuid=center_node_uuid,
6)
7relevant_edges = results.edges
8relevant_facts = [edge.fact for edge in relevant_edges]

In this recipe, we went through how to retrieve facts which are related to a specific node in a Zep knowledge graph. We first went through some methods for determining the UUID of the node you are interested in. Then, we went through some methods for retrieving the facts related to that node.