Zep
Type: full-code · Vendor: Zep AI · Language: Python, TypeScript, Go · License: Apache-2.0 · Status: active · Status in practice: mature
Context engineering platform that builds a per-user temporal knowledge graph from chat messages and business data, then assembles low-latency context for agent turns.
Description. Zep is a context engineering platform built around Graphiti, an open-source temporal knowledge graph engine that ingests conversational messages and structured business data and turns them into a graph of entities and facts with bi-temporal validity windows. Each user has their own User Graph; threads under that user feed messages into the graph via `thread.add_messages`, and agents retrieve assembled context with `thread.get_user_context` or low-level `graph.search`. When new data contradicts a prior fact, Zep stores the invalidation time on the fact's edge rather than deleting it, so agents can reason about how preferences and relationships changed. SDKs are available in Python, TypeScript, and Go.
Agent loop shape. Sidecar memory service backed by a temporal knowledge graph. The application creates a User and a Thread; on each user turn it calls `thread.add_messages` which ingests messages into that user's graph, where Graphiti extracts entities and facts as edges with valid_at and invalid_at timestamps. Before generating a reply the agent calls `thread.get_user_context` (high-level) or `graph.search` (low-level) to retrieve assembled context. Fact invalidation is handled automatically: when new data contradicts an existing fact, Zep stamps the old edge as invalidated rather than deleting it.
Primary use cases
- long-term agent memory with temporal reasoning
- voice and video agents needing sub-200ms context retrieval
- personalized assistants that track changing user state
- Graph RAG over conversational and business data
Key concepts
- User Graph → session-isolation (docs) — Per-user knowledge graph; threads belonging to that user feed into it.
- Threads (docs) — A conversation under a user; thread.add_messages ingests messages into the user-level graph.
- Graphiti (temporal knowledge graph) → knowledge-graph-memory (docs) — Open-source engine that builds the graph; entities are nodes, facts are edges with valid_at/invalid_at.
- Fact invalidation (docs) — When new data contradicts a fact, the edge is stamped invalidated rather than deleted.
- thread.get_user_context → cross-session-memory (docs) — High-level retrieval call returning assembled context (facts, entities, summaries) for the agent turn.
- Episodes / thread summaries / user summary → episodic-summaries (docs) — Distinct primitives Zep produces from a user graph: facts, entities, episodes, thread summaries, observations, user summary.
Patterns this full-code implements —
- ★★Cross-Session Memory
The User Graph persists across threads; messages added to any thread of that user are ingested into that user's graph, so prior sessions inform later ones.
- ★Knowledge Graph Memory
Graphiti is the core engine; nodes are entities, edges are facts, and the whole store is positioned as a unified knowledge graph rather than a vector index.
- ★★Session Isolation
Every thread belongs to a user; the per-user User Graph is the isolation boundary, and threadIds map to your business objects for further scoping.
- ★★Episodic Summaries
Zep produces explicit episodic primitives: episodes (raw ingested data), thread summaries, and a user summary, alongside extracted facts and entities.
- ·Five-Tier Memory Cascade
Honest downgrade — Zep's Graphiti uses three hierarchical subgraph tiers (episode, semantic entity, community) and distinguishes episodic vs semantic memory, but does not formalise the five-tier sens…