Create Graph
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
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:
- Add data to the graph by specifying
graph_idinstead ofuser_id - Search the graph for relevant information
- Read data from the graph to inspect nodes and edges
- Delete data from the graph when needed
- Clone the graph to create copies
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
- Learn how to add business data to your graph
- Explore graph search capabilities
- Understand how to customize graph structure