Episodes
Overview
An episode is a raw data artifact a developer hands to Zep — a chat message, a freeform text chunk, or a JSON object. Zep stores each episode verbatim alongside the entities, edges, and summaries it derives from that data, so the original source remains available even after extraction has finished. Thread messages are also episodes: each call to thread.add_messages persists a message episode on the user’s graph.
Reach for episodes when an agent needs grounded context with the exact source truth — quoting the original wording behind a fact, citing a source, or recovering surrounding context that did not become a fact in its own right.
Ingestion
Episodes enter Zep in two ways:
thread.add_messagesfor conversational data — each message becomes amessageepisode.graph.addfor non-conversational data, withtypeset totext(a document excerpt, note, or transcript) orjson(a structured record such as a CRM entry, ticket, or event).
Retrieval
The SDK lets you list recent episodes for a user, fetch one by UUID, or search a graph specifically for episodes.
List and fetch
Episode listing uses lastn (the most recent N items) rather than cursor pagination.
Search
To pull episodes most relevant to a query — for example, the source quotes behind a fact in the Context Block — use graph search with scope="episodes". Results land on results.episodes.
Episodes and the Context Block
Episodes are included in the default Context Block: the episodes most relevant to the user’s recent messages are rendered alongside facts and entities. To customize which episodes appear or how they are formatted, define a context template using the %{episodes} variable, or build a custom block via advanced context block construction.