Graphiti — Real-Time Knowledge Graphs for AI Agents
Build real-time knowledge graphs for AI agents by Zep. Temporal awareness, entity extraction, community detection, and hybrid search. Production-ready. 24K+ stars.
What it is
Graphiti is an open-source library by Zep that builds real-time knowledge graphs for AI agents. Unlike static knowledge bases, Graphiti continuously ingests new information, extracts entities and relationships, and maintains temporal awareness -- it knows when facts were added, updated, or became stale. The knowledge graph serves as long-term structured memory for agents that need to remember and reason over accumulated information.
Developers building AI agents that need persistent, structured memory beyond simple conversation history benefit most. Agents handling customer support, research, or multi-session workflows need to remember entities, relationships, and how they change over time.
How it saves time or tokens
Without Graphiti, agents typically store memory as flat text, which requires embedding search and often returns irrelevant context. Graphiti's graph structure enables precise entity lookups and relationship traversals. An agent can ask 'what is the status of Project X?' and get the current answer from the graph rather than searching through thousands of conversation turns. The temporal layer means outdated information does not pollute queries -- only the latest state is returned unless history is specifically requested.
How to use
- Install Graphiti:
pip install graphiti-core
- Initialize the graph and add episodes:
from graphiti_core import Graphiti
graph = Graphiti(neo4j_uri='bolt://localhost:7687', neo4j_user='neo4j', neo4j_password='password')
await graph.add_episode(
name='meeting_notes',
episode_body='Alice joined the team as lead engineer on April 10. The project deadline is May 15.',
source='meeting'
)
- Query the graph for entities and relationships:
results = await graph.search('What role does Alice have?')
print(results) # Returns: Alice -> lead engineer, added April 10
Example
# Add multiple episodes over time
await graph.add_episode(
name='update_1',
episode_body='Project deadline moved from May 15 to June 1 due to scope changes.',
source='slack'
)
# Graphiti updates the temporal state automatically
results = await graph.search('project deadline')
# Returns: June 1 (latest), with history showing May 15 was previous
# Entity-specific queries
entities = await graph.get_entity('Alice')
# Returns all relationships: role, team, projects, timeline
Related on TokRepo
- AI Memory Providers -- Graphiti deep-dive on TokRepo
- Knowledge Graph Tools -- Knowledge graph tools for AI agents
Common pitfalls
- Graphiti requires Neo4j as the graph database backend. Set up Neo4j before using Graphiti -- the Docker image is the quickest path.
- Entity extraction quality depends on the LLM used for processing episodes. Use a capable model (Claude, GPT-4) for accurate entity and relationship extraction.
- Large volumes of episodes can slow down graph updates. Batch episode ingestion during off-peak times for production workloads.
Frequently Asked Questions
Vector databases store embeddings for similarity search. Graphiti builds a structured knowledge graph with entities, relationships, and temporal metadata. Graph queries return precise entity-level answers; vector search returns similar text chunks. They solve different problems and can be complementary.
Yes. Graphiti uses Neo4j as its graph storage backend. Neo4j Community Edition is free and open source. Run it via Docker: 'docker run -p 7687:7687 neo4j:latest'.
Graphiti timestamps every entity and relationship when created or updated. When you add a new episode that contradicts earlier information, Graphiti updates the graph and preserves the history. Queries return the current state by default but can access the full timeline.
Yes. Graphiti integrates with agent frameworks as a memory backend. You can use it as a tool that agents call to store and retrieve structured knowledge during multi-step workflows.
Yes. Graphiti is open source and maintained by Zep. The core library (graphiti-core) is available on PyPI and GitHub under an open-source license.
Citations (3)
- Graphiti GitHub Repository— Graphiti builds real-time knowledge graphs for AI agents
- Zep Graphiti Documentation— Temporal awareness and entity extraction for agent memory
- arXiv: Knowledge Graphs for LLMs— Knowledge graphs for structured AI agent memory
Related on TokRepo
Source & Thanks
Created by Zep. Licensed under Apache 2.0. getzep/graphiti — 24,000+ GitHub stars
Discussion
Related Assets
Flax — Neural Network Library for JAX
A high-performance neural network library built on JAX, providing a flexible module system used extensively across Google DeepMind and the JAX research community.
PyCaret — Low-Code Machine Learning in Python
An open-source AutoML library that wraps scikit-learn, XGBoost, LightGBM, CatBoost, and other ML libraries into a unified low-code interface for rapid experimentation.
DGL — Deep Graph Library for Scalable Graph Neural Networks
A high-performance framework for building graph neural networks on top of PyTorch, TensorFlow, or MXNet, designed for both research prototyping and production-scale graph learning.