Graphiti — Temporal AI Knowledge Graph by Zep
Build dynamic knowledge graphs from AI agent conversations. Graphiti tracks entity changes over time, resolves contradictions, and provides temporal-aware queries.
What it is
Graphiti is a Python library by Zep that builds dynamic knowledge graphs from AI agent conversations and unstructured data. Unlike static knowledge graphs, Graphiti tracks entity changes over time, resolves contradictions when new information conflicts with old, and provides temporal-aware queries. It stores entities and relationships in Neo4j with timestamps for every fact.
Graphiti is designed for AI engineers building agents that need persistent, evolving memory with the ability to query what was true at any point in time.
How it saves time or tokens
Traditional AI memory (vector stores, chat history) loses temporal context. If a user says 'I work at Google' in January and 'I just started at Meta' in March, a vector store returns both facts without knowing which is current. Graphiti tracks these changes: it marks the Google fact as superseded and the Meta fact as current. This eliminates contradictions in agent memory and reduces the tokens spent resolving conflicting context.
How to use
- Install Graphiti:
pip install graphiti-core
- Initialize with Neo4j and add episodes:
from graphiti_core import Graphiti
from graphiti_core.llm_client import AnthropicClient
graphiti = Graphiti(
uri='bolt://localhost:7687',
llm_client=AnthropicClient(),
)
await graphiti.build_indices()
# Add conversation episodes
await graphiti.add_episode(
name='user_chat_1',
episode_body='User said: I work at Google as a senior engineer.',
source_description='chat',
)
await graphiti.add_episode(
name='user_chat_2',
episode_body='User said: I just started at Meta last week.',
source_description='chat',
)
- Query the graph:
results = await graphiti.search('Where does the user work?')
# Returns: Meta (current), with Google marked as previous
Example
Temporal querying to understand entity changes:
# Query current state
current = await graphiti.search('user employment')
print(current) # User works at Meta (since March 2026)
# Query historical state
from datetime import datetime
historical = await graphiti.search(
'user employment',
as_of=datetime(2026, 2, 1),
)
print(historical) # User works at Google (as of Feb 2026)
# The graph automatically:
# - Created a 'User' entity node
# - Created 'Google' and 'Meta' organization nodes
# - Created 'WORKS_AT' relationships with timestamps
# - Marked the Google relationship as superseded
Related on TokRepo
- AI memory tools — Browse persistent memory solutions for AI agents
- Knowledge graph tools — Explore knowledge graph tools
Common pitfalls
- Not running Neo4j before starting Graphiti. Graphiti requires a Neo4j instance for graph storage. Start Neo4j with Docker:
docker run -p 7687:7687 -p 7474:7474 neo4j. - Adding too many episodes at once without letting the graph consolidate. Graphiti resolves contradictions during episode ingestion. Large batch ingestion may produce unexpected entity merges.
- Expecting Graphiti to work without an LLM. Graphiti uses an LLM (Claude or GPT) to extract entities and relationships from unstructured text. An LLM API key is required.
Frequently Asked Questions
A temporal knowledge graph tracks when facts become true and when they are superseded. Every entity and relationship has timestamps. This lets you query what was true at any point in time, not just what is currently true.
Graphiti uses Neo4j for graph storage. Neo4j provides the property graph model and Cypher query language that Graphiti uses to store and query entities, relationships, and their temporal metadata.
When new information contradicts existing facts, Graphiti marks the old fact as superseded with a timestamp and creates the new fact as current. The old fact remains in the graph for historical queries but is not returned for current-state queries.
Yes. Graphiti is built by the Zep team and integrates with the broader Zep memory platform. You can use Graphiti standalone or as part of a Zep deployment for agent memory management.
Graphiti supports Anthropic (Claude) and OpenAI (GPT) for entity extraction. You configure the LLM client when initializing Graphiti. The LLM is used to extract entities and relationships from unstructured text.
Citations (3)
- Graphiti GitHub— Graphiti builds temporal knowledge graphs
- Zep Documentation— Zep memory platform for AI agents
- Neo4j— Neo4j graph database
Related on TokRepo
Source & Thanks
Created by Zep AI. Licensed under Apache 2.0.
getzep/graphiti — 3k+ stars