Create Graph

Create standalone graphs for advanced use cases

Overview

While most use cases benefit from user-centric graphs that automatically integrate with users and threads, Zep also supports creating standalone graphs. Standalone graphs are useful for specific scenarios where you need independent knowledge graphs that aren’t tied to individual users.

When to use standalone graphs

Consider using standalone graphs when you need to:

  • Create shared knowledge bases across multiple users
  • Build domain-specific knowledge graphs independent of user context
  • Maintain separate graphs for testing or experimentation
  • Implement custom graph architectures for specialized use cases

For most applications, we recommend using user graphs (created automatically when you add a user) as they integrate directly with Zep’s context retrieval systems.

Creating a Standalone Graph

1from zep_cloud.client import Zep
2
3client = Zep(
4 api_key=API_KEY,
5)
6
7# Create a standalone graph with a custom ID
8result = client.graph.create(
9 graph_id="my_custom_graph"
10)
11
12print(f"Created graph with ID: {result.graph_id}")

Seed the graph

A standalone graph starts empty. Unlike a user graph, which is created with a user node representing its subject, a standalone graph has no node until you add data. Before adding ongoing data, you can optionally seed the graph with the core facts about its subject, so that later data attaches to a well-formed subject.

For example, give a new company graph the company’s name, industry, and key people. Seed it by adding episodes with graph.add, by asserting known relationships with add_fact_triple, or both.

Working with standalone graphs

Once created, you can work with standalone graphs using the same methods as user graphs:

Customizing Graph Structure

Standalone graphs can be customized with entity and edge types just like user graphs. See Customizing Graph Structure for details on how to define custom ontologies for your graph.

Next Steps