Reading Data from the Graph
Zep provides APIs to read Edges, Nodes, and Episodes from the graph. These elements can be retrieved individually using their UUID, or as lists associated with a specific user_id or graph_id. The latter method returns all objects in that user’s or graph’s data.
Examples of each retrieval method are provided below.
Reading Edges
Reading Nodes
Reading Episodes
Listing artifacts in bulk
The methods above return a single artifact by its UUID. To enumerate artifacts of a given type in bulk, use the list methods. Where searching the graph ranks results by relevance to a query, the list methods return everything of a given type in a user or graph, with filtering, sorting, and pagination applied server-side.
Reach for these methods when you are not answering a question but enumerating data: rendering an entity browser or a facts table in a UI, exporting a graph, or auditing what a graph contains. Sorting and cursor pagination let you walk large graphs in stable, predictable pages instead of pulling everything into memory at once.
The same parameters — filters, order_by, direction, limit, and cursor — are shared across four artifact types:
- Nodes (entities) — see Entities.
- Edges (facts) — see Facts.
- Observations — see Observations.
- Thread summaries — see Thread summaries.
Each type exposes two list methods: get_by_user_id for a user’s graph and get_by_graph_id for a named graph. Both return a flat array of typed objects.
Shared parameters
All four artifact types accept the same parameters on both get_by_user_id and get_by_graph_id.
The filters object is the same SearchFilters type documented under Search Filters, so date, type, and property filters behave identically here. Refer to that section for the full filter reference.
Listing nodes
List the entities in a user’s graph, most recently created first.
To list entities in a named (non-user) graph, use get_by_graph_id with a graph_id. See Entities for per-type detail.
Listing edges with filters
Pass a SearchFilters object to narrow the results. The example below lists facts on a named graph that were created in July 2025 and use specific edge types.
The date filter uses the same 2D OR/AND array structure as graph.search: the outer array is OR, the inner array is AND. See Datetime Filtering for the full semantics.
Pagination
The list methods return a flat array, not a paginated envelope. The forward cursor for the next page comes back in the Zep-Next-Cursor response header. To read it, use the SDK’s raw response accessor — with_raw_response in Python, withRawResponse in TypeScript, and WithRawResponse in Go — which returns both the parsed data and the raw HTTP response.
Pass the cursor from one page as the cursor argument of the next call. When the header is empty, there are no more pages.
uuid_cursor is the deprecated legacy pagination path: pass the UUID of the last item from the previous page to fetch the next one. Prefer the opaque cursor from the Zep-Next-Cursor header, which encodes the sort field, direction, and continuation position.
Listing observations and thread summaries
Observations and thread summaries use the same shared parameters. The examples below list each for a user, newest first.
See Observations and Thread summaries for per-type detail. Use get_by_graph_id for a named graph.
Episodes are different
Episodes do not use the shared list parameters. graph.episode.get_by_user_id and graph.episode.get_by_graph_id accept only lastn — the most-recent-N episodes. They do not support cursor, filters, order_by, direction, or limit.
Related
- Searching the graph — rank artifacts by relevance to a query, including the full
SearchFiltersreference. - Entities, Facts, Observations, and Thread summaries — per-type detail for each artifact.