AI/TLDR

Graphiti

Build temporal knowledge graphs that track how an AI agent's facts change over time

Overview

Graphiti is an open-source Python framework for building and querying temporal context graphs for AI agents. Instead of treating an agent's history as flat document chunks or raw chat logs, it turns conversations and other data into a graph of entities, relationships, and facts. Each fact carries a validity window, so the graph records both what is true now and what was true before.

It is aimed at developers building context-aware agents that work with data that keeps changing. New episodes (the raw data you feed in) are integrated incrementally, without recomputing the whole graph, and every derived fact traces back to its source. You can define entity and edge types up front with Pydantic models, or let structure emerge from the data.

As a memory framework, Graphiti fills the role of long-term agent memory: it stores interactions and enterprise data in a queryable graph and retrieves context using a mix of semantic embeddings, BM25 keyword search, and graph traversal. It is the open-source engine behind Zep's managed context infrastructure, and can be used on its own with a supported graph database.

What it does

  • Temporal fact management: facts have validity windows, and when information changes old facts are invalidated rather than deleted, so you can query the current state or any past point in time
  • Episodes and provenance: every entity and relationship traces back to the raw episodes that produced it, giving full lineage from a derived fact to its source data
  • Prescribed and learned ontology: define entity and edge types with Pydantic models, or let structure emerge from the data as patterns appear
  • Incremental graph construction: new data integrates immediately without batch recomputation, so the graph evolves as episodes are ingested
  • Hybrid retrieval: combines semantic embeddings, keyword (BM25) search, and graph traversal for low-latency queries without relying on LLM summarization
  • Pluggable backends: works with Neo4j, FalkorDB, and Amazon Neptune, and supports OpenAI, Anthropic, Google Gemini, and Groq as LLM providers

Getting started

Graphiti is a Python package (graphiti-core) that connects to a graph database and an LLM provider. You need Python 3.10+, a supported graph database such as Neo4j 5.26+, and an OpenAI API key for the default LLM.

Install the package

Install graphiti-core with pip or uv. Optional extras add support for FalkorDB or alternative LLM providers.

bashbash
pip install graphiti-core

Set your LLM API key

OpenAI is the default LLM provider, so export your key before running. Anthropic, Google Gemini, and Groq are available via extras.

bashbash
export OPENAI_API_KEY=your-api-key

Connect, add an episode, and search

Point Graphiti at your graph database (here a local Neo4j over bolt), ingest a piece of raw data as an episode, then query for related edges and nodes. These calls are async.

pythonpython
from graphiti_core import Graphiti

graphiti = Graphiti(
    "bolt://localhost:7687",
    "neo4j",
    "password"
)

# Add episodes (raw data)
await graphiti.add_episode("user_message_text")

# Search for relationships
results = await graphiti.search_edges("query_text")

# Search for nodes
node_results = await graphiti.search_nodes("entity_name")

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Give a conversational agent long-term memory that tracks how a user's preferences and facts change across sessions
  • Combine structured and unstructured enterprise data into one queryable graph for a context-aware assistant
  • Answer historical questions by querying what was true at a specific point in time, not just the current state
  • Provide MCP clients such as Claude or Cursor with temporal, graph-based memory via the included MCP server

How Graphiti compares

Graphiti alongside other open-source agent memory tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Mem0★ 59.6kA memory layer that you add to existing LLM agents to extract, store, and recall user facts and preferences across sessions using vector, graph, and key-value backends.
Graphiti★ 28.1kBuild temporal knowledge graphs that track how an AI agent's facts change over time
Supermemory★ 27.8kA memory and context engine that ingests information across tools and sessions and can run fully locally, acting as a second brain for AI applications.
Cognee★ 24.1kA graph-native memory engine that turns raw documents and conversations into a queryable knowledge graph for agents that need to build lasting knowledge.
Letta★ 23.6kA framework (formerly MemGPT) for building stateful agents with long-term memory that persists across sessions and conversations.
Memvid★ 15.7kMemvid packs an AI agent's data, embeddings, and search index into one portable file, so it can retrieve memory fast without running a vector database.
Memori★ 15.5kAn SQL-native memory engine that gives any LLM persistent, structured memory stored in standard PostgreSQL or MySQL databases instead of a vector store.
MemU★ 13.9kA memory layer for AI agents that organizes structured storage and intent capture to reduce the tokens needed to keep context across conversations.