Skip to main content

Graph Schema Overview

Graphiti’s knowledge graph is composed of nodes (entities, episodes, communities, sagas) and edges (relationships between nodes). Understanding this schema is essential for working with Graphiti effectively.

Node Types

EntityNode

Represents real-world entities extracted from episodes—people, organizations, concepts, events, etc.

Example

Key Fields

name: The canonical name of the entity
  • Graphiti deduplicates entities by name similarity
  • Used for entity resolution across episodes
name_embedding: Vector representation for semantic search
  • Generated by your configured embedder (e.g., OpenAI, Voyage)
  • Enables similarity-based entity retrieval
summary: Automatically generated from connected edges
  • Aggregates facts from all EntityEdges connected to this node
  • Updated as new information is added
  • Useful for quick entity context
labels: Entity types for classification
  • Can be a single type: ["Person"]
  • Or multiple types: ["Person", "Executive", "Founder"]
  • Used with custom entity types (see Custom Entity Types guide)
attributes: Flexible key-value properties
  • Store domain-specific data
  • Defined by custom entity type schemas
  • Extracted by LLM during processing

Working with EntityNodes

EpisodicNode

Stores raw input episodes with temporal metadata. See Episodes for detailed information.

Example

CommunityNode

Represents clusters of related entities discovered through graph analysis. See Communities for details.

Example

SagaNode

Organizes sequences of related episodes (e.g., conversation threads, event timelines).

Example

Edge Types

EntityEdge (RELATES_TO)

Represents semantic relationships between entities, with temporal validity tracking.

Example

Key Fields

name: The relationship type
  • Examples: "works_at", "knows", "located_in", "married_to"
  • Can be customized with edge types (see Custom Edge Types guide)
fact: Human-readable description of the relationship
  • Used for search and retrieval
  • Embedded for semantic similarity
fact_embedding: Vector representation for semantic search
  • Generated from the fact text
  • Enables similarity-based edge retrieval
episodes: Provenance tracking
  • Lists all episodes that mentioned this relationship
  • Enables tracing back to original sources
Temporal fields: See Temporal Model
  • valid_at: When the fact became true in the real world
  • invalid_at: When the fact stopped being true
  • created_at: When Graphiti learned about it
  • expired_at: When superseded by newer information

Working with EntityEdges

EpisodicEdge (MENTIONS)

Links episodes to the entities they mention.

Purpose

EpisodicEdges provide provenance—you can always trace which episodes mentioned which entities.

CommunityEdge (HAS_MEMBER)

Links communities to their member entities.

Usage

HasEpisodeEdge (HAS_EPISODE)

Links sagas to their episodes.

NextEpisodeEdge (NEXT_EPISODE)

Chains episodes in chronological order within a saga.

Usage

Node and Edge Inheritance

All nodes and edges inherit from base classes:
This provides consistent interfaces for all graph elements.

Graph Queries

Finding Connected Information

Traversing Multi-Hop Relationships

Temporal Queries

Embeddings

Graphiti generates vector embeddings for semantic search:

Entity Name Embeddings

Edge Fact Embeddings

Embedding Configuration

Database Backend Differences

Graphiti supports multiple graph databases with minor schema variations:

Neo4j, FalkorDB, Neptune

Kuzu

Graphiti’s driver abstraction handles these differences automatically. You don’t need to write different queries for different backends.

Custom Attributes

Both EntityNodes and EntityEdges support custom attributes:

Group IDs and Multi-Tenancy

Every node and edge has a group_id field for partitioning:

Schema Visualization

Here’s the complete graph schema:

Next Steps

Communities

Learn about community detection and clustering

Custom Types

Define custom entity and edge types

Search

Query nodes and edges effectively

Temporal Model

Understand temporal aspects of nodes and edges