ScriptsMar 30, 2026·2 min read

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.

TL;DR
Graphiti builds real-time knowledge graphs with temporal awareness, entity extraction, and relationship tracking for AI agent memory.
§01

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.

§02

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.

§03

How to use

  1. Install Graphiti:
pip install graphiti-core
  1. 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'
)
  1. 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
§04

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
§05

Related on TokRepo

§06

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

What is the difference between Graphiti and a vector database?+

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.

Does Graphiti require Neo4j?+

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'.

How does temporal awareness work?+

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.

Can I use Graphiti with LangChain or CrewAI?+

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.

Is Graphiti open source?+

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)
🙏

Source & Thanks

Created by Zep. Licensed under Apache 2.0. getzep/graphiti — 24,000+ GitHub stars

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets