A temporal knowledge graph records when each fact was true and where it came from. Standard vs temporal, what bi-temporal means, and why AI agents need it.
A temporal knowledge graph is a knowledge graph in which every fact carries time — when it became true, when it stopped being true, and where it came from — so the graph represents not just what is known, but how that knowledge changed over time. Where a standard knowledge graph stores entities and relationships as if they're permanently true, a temporal knowledge graph tracks state as it evolves, which is exactly what AI agents need to reason about users and the world without contradicting themselves.
| Standard knowledge graph | Temporal knowledge graph | |
|---|---|---|
| Represents | Entities + relationships | Entities + relationships + time |
| Handles change | Overwrites or duplicates facts | Invalidates old facts, keeps history |
| Can answer “what was true then?” | No | Yes |
| Provenance | Often none | Each fact traces to its source |
| Built for | Static domains | Evolving state (users, agents, business) |
Facts about people and businesses change constantly. A user upgrades a plan, changes a preference, closes an account; a deal moves stages; a policy is updated. A graph that can't represent when a fact was true will eventually serve an agent two contradictory facts and let it pick — the single most common cause of agent hallucination. A temporal knowledge graph removes that ambiguity: it knows the current truth and the historical truth, and can answer either.
The strongest temporal knowledge graphs are bi-temporal — they track two timelines for every fact:
With both, an agent can ask “what is true now?”, “what was true on this date?”, and “where did this fact come from?” — and get a correct, auditable answer to each. When new information contradicts an existing fact, the old fact is marked invalid (not deleted), so history is preserved.
Reason for return
Additional comments
In a bi-temporal graph, each fact (edge) carries four timestamps — which is what makes point-in-time queries and automatic invalidation possible:
| Timestamp | Meaning |
|---|---|
| valid from | when the fact became true in the world |
| valid to | when it stopped being true (open if still current) |
| observed | when the source stated it |
| recorded | when the system ingested it (provenance) |
A query for “what was true on 2025-12-01” filters to edges whose valid-from/valid-to window contains that date; a query for “now” filters to open windows. Because superseded facts are closed, not deleted, the history stays auditable. (See the Zep paper for the full data model.)
from zep_cloud import Zep
client = Zep(api_key="YOUR_API_KEY")
# Retrieval respects validity windows: the graph returns the fact that
# was valid at query time, with provenance back to its source episode.
results = client.graph.search(
user_id=user_id,
query="What plan is this user on?",
limit=5,
)For agent memory, the graph is constructed continuously from the agent's inputs — chat messages, business data (JSON), and documents. The system extracts entities, relationships, and facts; assigns each a validity window and provenance; and updates the graph as new information arrives, invalidating superseded facts. At query time it retrieves the relevant, current (or as-of-date) slice — not the whole history.
This is what Graphiti does. Graphiti is the open-source temporal knowledge graph library purpose-built for agent memory (20,000+ GitHub stars). It constructs bi-temporal context graphs from any source and powers Zep's agent-memory platform. When scaled with Zep, Graphiti runs on top of the Context Graph Engine — the runtime that serves millions of these graphs with sub-200ms p95 retrieval. Zep is the Context Lake for AI agents: the platform that manages, governs, and serves agent memory at scale on temporal knowledge graphs.
A vector store retrieves text chunks by similarity and has no concept of time or relationships — it can return a stale fact and a current one with equal confidence. A temporal knowledge graph models the relationships and the timeline, so it returns what's true now (or as-of a date) with provenance. For agent memory, the temporal graph is the right structure; vector search is a useful component inside it, not a substitute.
Related: What is agent memory? · Graphiti (open source) · Context Graph Engine · Agent memory vs RAG · AI agent memory guides
A knowledge graph that records when each fact was true and where it came from — so it can tell you what's true now, what was true before, and why.
A standard knowledge graph treats facts as timeless. A temporal one tracks how facts change, invalidating old facts while preserving history — essential for agents reasoning over evolving state.
It tracks two timelines per fact: when the fact was true in the world (valid time) and when the system learned it (ingestion time / provenance).
Graphiti is the leading open-source temporal knowledge graph built specifically for agent memory; it powers Zep's Context Lake at enterprise scale.
A graph database is general-purpose storage for one large graph. A temporal knowledge graph for agents is purpose-built: bi-temporal edges, automatic fact invalidation, episode-level provenance, and a runtime tuned for millions of small, mostly-cold graphs. Graphiti runs on graph databases (e.g., Neo4j, FalkorDB) when self-hosted, or on Zep's Context Graph Engine at scale.
When new information contradicts an existing fact, the system closes the old fact's validity window (sets “valid to”) rather than deleting it, and records the new fact. The agent reasons over the current state while the history stays queryable.
GraphRAG retrieves over a graph instead of flat chunks. A temporal knowledge graph adds time and provenance to that graph, so retrieval reflects what's true now — or as of a past date — not just what's structurally related.