As an alternative to polling, you can use webhooks to get notified when episodes finish processing.
Data added to Zep is processed asynchronously and can take a few seconds to a few minutes to finish processing. This recipe shows how to check whether data upload operations are finished processing.
Zep provides two methods for checking data ingestion status:
client.task.get() to check the status of clone operations and fact triple additionsgraph.episode.get() to check individual episode processing statusFor tracking large historical ingestions, see the Batch API, which has its own progress reporting via batch.get and per-item status via batch.list_items.
When using operations that return a task_id, you can poll for completion status using client.task.get(). The following operations return a task_id:
graph.clone() - Graph cloning operationsgraph.add_fact_triple() - Custom fact/node triplet additionsThe pattern is the same in both cases: capture the task_id returned by the operation, then poll client.task.get(task_id=task_id) until status is succeeded or failed.
For single episode operations or when you need to check the status of individual episodes, you can use the graph.episode.get() method. This approach is useful when adding data one episode at a time.
First, let’s create a user:
Now, let’s add some data and immediately try to search for that data; because data added to Zep is processed asynchronously and can take a few seconds to a few minutes to finish processing, our search results do not have the data we just added:
We can check the status of the episode to see when it has finished processing, using the episode returned from the graph.add method and the graph.episode.get method:
Now that the episode has finished processing, we can search for the data we just added, and this time we get a result: