Deleting Data from the Graph

Delete an Edge

Here’s how to delete an edge from a graph:

1from zep_cloud.client import Zep
2
3client = Zep(
4 api_key=API_KEY,
5)
6
7client.graph.edge.delete(uuid_="your_edge_uuid")

Note that when you delete an edge, it never deletes the associated nodes, even if it means there will be a node with no edges.

Delete a Node

Here’s how to delete a node from a graph:

1from zep_cloud.client import Zep
2
3client = Zep(
4 api_key=API_KEY,
5)
6
7client.graph.node.delete(uuid_="your_node_uuid")

Deleting a node will also delete all edges connected to that node. This is a cascading delete operation - the node and all its relationships are permanently removed from the graph.

Delete an Episode

Deleting an episode does not regenerate the names or summaries of nodes shared with other episodes. This episode information may still exist within these nodes. If an episode invalidates a fact, and the episode is deleted, the fact will remain marked as invalidated.

When you delete an episode, it will delete all the edges associated with it, and it will delete any nodes that are only attached to that episode. Nodes that are also attached to another episode will not be deleted.

Here’s how to delete an episode from a graph:

1from zep_cloud.client import Zep
2
3client = Zep(
4 api_key=API_KEY,
5)
6
7client.graph.episode.delete(uuid_="episode_uuid")

Delete a Thread

Deleting a thread removes all episodes associated with that thread. This triggers a cascading effect on the graph.

When a thread is deleted, each associated episode is removed. For each episode:

  • Edges are deleted if they were created by that specific episode
  • Nodes are deleted only if no other episodes reference them

This design preserves graph integrity. If multiple conversations mention the same entity or establish the same relationship, deleting one thread will not remove data that other threads contributed to the graph.

Here’s how to delete a thread:

1from zep_cloud.client import Zep
2
3client = Zep(
4 api_key=API_KEY,
5)
6
7client.thread.delete(thread_id="your_thread_id")