Skip to navigation

Cloning Graphs

Create complete copies of graphs with new identifiers for testing, migration, or templating

Overview

The graph.clone method creates a complete copy of a graph with a new identifier. Clone a user graph to test or migrate one user’s context. Clone a shared Context Graph to create an isolated test copy of an account, project, product, or business-domain graph, or to use a maintained graph as a template.

The clone operation returns a task_id that you can use to track the operation. See Check data ingestion status for polling instructions.

The target graph must not exist - they will be created as part of the cloning operation. If no target ID is provided, one will be auto-generated and returned in the response.

Clone a Graph

from zep_cloud.client import Zep
client = Zep(
api_key=API_KEY,
)
# Clone a user graph to a new user ID
result = client.graph.clone(
source_user_id="user_123",
target_user_id="user_123_copy" # Optional - will be auto-generated if not provided
)
print(f"Cloned graph to user: {result.user_id}")
print(f"Clone task ID: {result.task_id}")

Key Behaviors and Limitations

  • Target Requirements: The target user or graph must not exist and will be created during the cloning operation
  • Auto-generation: If no target ID is provided, Zep will auto-generate one and return it in the response
  • Node Modification: The central user entity node in the cloned graph is updated with the new user ID, and all references in the node summary are updated accordingly