Skip to main content

What is a Knowledge Graph?

A knowledge graph is a network of interconnected facts represented as triplets—each consisting of two entities (nodes) and their relationship (edge). For example, the fact “Kendra loves Adidas shoes” becomes:
  • Source Node: Kendra (entity)
  • Edge: loves (relationship)
  • Target Node: Adidas shoes (entity)
Knowledge graphs enable AI agents to reason about complex, interconnected information by representing it as a queryable network rather than isolated documents.

The Graphiti Approach

While traditional knowledge graphs have been used extensively for information retrieval, Graphiti introduces a unique approach tailored for AI agents:

Autonomous Graph Building

Graphiti autonomously constructs knowledge graphs from unstructured and structured data without requiring manual schema definition. When you add an episode (a unit of information), Graphiti:
  1. Extracts entities using LLMs to identify people, places, organizations, and custom entity types
  2. Identifies relationships between entities with semantic meaning
  3. Resolves duplicates by detecting when new information refers to existing entities
  4. Updates the graph incrementally without batch recomputation

Temporal Awareness

Unlike traditional static graphs, Graphiti maintains a temporal dimension:
This enables:
  • Point-in-time queries: “Who was the Attorney General in 2015?”
  • Tracking evolving relationships: “When did Alice start working at Acme Corp?”
  • Handling contradictions: New information can invalidate old facts without deletion
Graphiti tracks both when facts occurred in the real world (valid_at/invalid_at) and when they were ingested into the system (created_at/expired_at). This bi-temporal model is crucial for accurate historical reasoning.

Graph Structure

A Graphiti knowledge graph consists of several node and edge types:

Node Types

Edge Types

Knowledge Representation Example

Consider this episode:
Graphiti extracts: Entities:
  • Node: “Kamala Harris” (Person)
  • Node: “California” (Location)
  • Node: “San Francisco” (Location)
  • Node: “Attorney General” (Position)
  • Node: “District Attorney” (Position)
Relationships:
  • Edge: Kamala Harris → holds position → Attorney General
    • Fact: “Kamala Harris is the Attorney General of California”
  • Edge: Kamala Harris → previously held → District Attorney
    • Fact: “She was previously the district attorney for San Francisco”
Episode Link:
  • EpisodicEdge: “Career Update” → mentions → “Kamala Harris”

Why Graphiti vs Traditional Approaches

vs. RAG (Retrieval-Augmented Generation)

Traditional RAG systems retrieve document chunks based on semantic similarity. Graphiti goes further:
  • Structured relationships: Instead of text chunks, retrieve specific facts with context
  • Graph traversal: Find related information by following edges
  • Temporal queries: Filter by when facts were true, not just when documents were created
  • Contradiction handling: Automatically invalidates outdated information

vs. GraphRAG

Real-Time Incremental Updates

One of Graphiti’s key advantages is real-time processing:
Graphiti’s incremental updates make it ideal for AI agents that need to maintain accurate, up-to-date knowledge without costly batch reprocessing.
Graphiti combines three search methods for comprehensive retrieval:
  1. Semantic search: Vector similarity on embedded facts and entity names
  2. Keyword search: BM25 full-text search for precise term matching
  3. Graph traversal: Navigate relationships to find connected information

Group IDs for Multi-Tenancy

Graphiti supports partitioning graphs by group_id, enabling:
  • Multi-user applications: Separate knowledge graphs per user
  • Organizational hierarchies: Team-level or project-level graphs
  • Access control: Query only the groups a user has permission for

Next Steps

Temporal Model

Learn about Graphiti’s bi-temporal data model

Episodes

Understand episodes as units of information

Nodes and Edges

Explore the graph schema in detail

Communities

Discover community detection for topic clustering