# 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. ## Install Copy the content below into your project: ## Quick Use ```bash pip install graphiti-core ``` ```python 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 episodes (conversations) await graphiti.add_episode( name="user_onboarding", episode_body="Alice is a senior engineer at Acme Corp working on payments.", source_description="User onboarding conversation", ) # Search the graph results = await graphiti.search("Who works at Acme Corp?") for r in results: print(r.fact) # "Alice is a senior engineer at Acme Corp" ``` ## What is Graphiti? Graphiti is an open-source library for building temporal knowledge graphs from AI agent interactions. Unlike static knowledge bases, Graphiti tracks how entities and relationships change over time, resolves contradictions, and maintains a living graph that evolves with every conversation. **Answer-Ready**: Graphiti is an open-source temporal knowledge graph library by Zep. It builds dynamic entity-relationship graphs from AI agent conversations, tracks changes over time, resolves contradictions, and provides temporal-aware search. Works with Claude and GPT. **Best for**: AI agent developers building systems with evolving knowledge. **Works with**: Neo4j, Claude, GPT, any LLM. **Setup time**: Under 10 minutes (requires Neo4j). ## Core Features ### 1. Automatic Entity Extraction ```python # From conversation text, Graphiti extracts: await graphiti.add_episode( name="meeting_notes", episode_body="Bob joined the payments team last Monday. He previously worked at Stripe.", ) # Entities: Bob (person), Payments Team (team), Stripe (company) # Relations: Bob --joined--> Payments Team (date: last Monday) # Bob --previously_worked_at--> Stripe ``` ### 2. Temporal Tracking Every fact has a time dimension: ```python # March: "Alice uses React for frontend" # June: "Alice switched to Vue.js" results = await graphiti.search("What framework does Alice use?") # Returns: "Alice uses Vue.js" (knows React is outdated) # But you can also query historically: results = await graphiti.search("What did Alice use in March?") # Returns: "Alice used React" ``` ### 3. Contradiction Resolution ```python # Episode 1: "The API uses REST" # Episode 2: "We migrated the API to GraphQL" # Graphiti detects the contradiction and updates the graph: # Old edge: API --uses--> REST (invalidated) # New edge: API --uses--> GraphQL (current) ``` ### 4. Hybrid Search ```python # Semantic search results = await graphiti.search("payment processing architecture") # With time filter results = await graphiti.search( "team changes", center_node_uuid=alice_uuid, num_results=10, ) ``` ### 5. Graph Visualization Query the Neo4j database directly for visualization: ```cypher MATCH (n)-[r]->(m) WHERE n.name = 'Alice' RETURN n, r, m ``` ## Architecture ``` Conversations/Episodes ↓ Graphiti Engine ├── Entity Extractor (LLM) ├── Relation Extractor (LLM) ├── Contradiction Resolver (LLM) └── Temporal Manager ↓ Neo4j Graph Database ├── Entities (nodes) ├── Relations (edges with timestamps) └── Episodes (source tracking) ↓ Hybrid Search (semantic + graph traversal) ``` ## Requirements - Python 3.10+ - Neo4j 5.x (local or Aura cloud) - LLM API key (Anthropic or OpenAI) ## FAQ **Q: How does Graphiti compare to basic RAG?** A: RAG retrieves static text chunks. Graphiti maintains structured, evolving knowledge with entity relationships and temporal awareness. **Q: Can I use it without Neo4j?** A: Currently Neo4j is required. It is the graph database backend for entity/relation storage. **Q: Is it related to Zep?** A: Yes, Graphiti is built by the Zep team. Zep uses Graphiti internally for its knowledge graph features. ## Source & Thanks > Created by [Zep AI](https://github.com/getzep). Licensed under Apache 2.0. > > [getzep/graphiti](https://github.com/getzep/graphiti) — 3k+ stars ## Quick Start ```bash pip install graphiti-core ``` Automatically build time-aware knowledge graphs from AI agent conversations. ## What is Graphiti? Graphiti is an open-source temporal knowledge graph library. It builds dynamic entity-relationship graphs from AI agent interactions, tracking changes, resolving contradictions, and providing time-aware search. **In one sentence**: Zep's open-source temporal knowledge graph — builds dynamic entity-relationship graphs from AI conversations, tracks changes, and resolves contradictions. **For**: Developers building AI agent systems with evolving knowledge. **Requires**: Neo4j + LLM API. ## Core Features ### 1. Automatic Entity Extraction Extracts people, organizations, technologies, and other entities and relationships from conversations. ### 2. Temporal Tracking Every fact has a time dimension — knows which information is outdated. ### 3. Contradiction Resolution Automatically detects and handles contradictory information. ### 4. Hybrid Search Semantic search + graph traversal. ## FAQ **Q: How does it compare to RAG?** A: RAG retrieves static text; Graphiti maintains a structured, evolving knowledge graph. **Q: What's the relationship with Zep?** A: Built by the Zep team — Zep internally uses Graphiti's knowledge graph features. ## Source & Thanks > [getzep/graphiti](https://github.com/getzep/graphiti) — 3k+ stars, Apache 2.0 --- Source: https://tokrepo.com/en/workflows/graphiti-temporal-ai-knowledge-graph-zep-1c08f869 Author: Agent Toolkit