Check Data Ingestion Status
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:
- Task polling (recommended for async operations): Use
client.task.get()to check the status of batch operations, clone operations, and fact triple additions - Episode polling: Use
graph.episode.get()to check individual episode processing status
Checking Operation Status with Task Polling
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.add_batch()- Batch episode additionsthread.add_messages_batch()- Batch message additions to threadsgraph.clone()- Graph cloning operationsgraph.add_fact_triple()- Custom fact/node triplet additions
This is the recommended approach for these operations as it provides a single status check for the entire operation.
First, letβs create a user:
Now, letβs add a batch of episodes to the graph. The response includes a task_id in each episode that we can use to check the processing status:
Now we can poll the task status using client.task.get() to check when the entire batch has finished processing:
Once the batch is complete, you can search for the data that was added:
Checking Individual Episode Status with Episode Polling
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: