Building AI Knowledge Graph Using Graphiti & Neo4j

Pradip NichitePradip Nichite
4 min read

Graphiti is a compact yet powerful Python library that converts raw text or JSON into an AI Knowledge Graph—a structured store of facts that acts as AI Agent Memory. Below is the exact workflow I used to load FutureSmart AI data into Neo4j, explore the resulting AI Graph Memory, and run hybrid (semantic + keyword) searches.


1. Why Graphiti for AI Agent Memory?

  • Real‑time inserts – Add new facts without bulk re‑processing.

  • LLM‑powered parsing – Entity extraction, relationship mapping, summaries, and embeddings handled automatically.

  • Neo4j under the hood – First‑class graph database with Cypher, indexes, and visualization tools.

  • Perfect for AI Agent Memory – Your agent can recall structured facts on demand.


2. Quick Refresher: Knowledge‑Graph Basics

“Pradip Nichite founded FutureSmart AI.”
ComponentExample
EntityPradip Nichite
EntityFutureSmart AI
Edgefounded
Triple(Pradip Nichite, founded, FutureSmart AI)

Graphiti stores each triple as Neo4j nodes (Entity) and edges (RELATES_TO), plus an Episode node that records the original text—together forming your AI Graph Memory.


3. Setup

pip install graphiti-core  # build your AI Knowledge Graph in minutes
import os
from google.colab import userdata

os.environ["OPENAI_API_KEY"] = userdata.get("OPENAI_API_KEY")
neo4j_uri      = "neo4j+s://<your‑instance>.databases.neo4j.io"
neo4j_user     = "neo4j"
neo4j_password = userdata.get("NEO4J_PASSWORD")

4. Initialise Graphiti (clean slate)

from graphiti_core import Graphiti
from graphiti_core.utils.maintenance.graph_data_operations import clear_data

graphiti = Graphiti(neo4j_uri, neo4j_user, neo4j_password)
await clear_data(graphiti.driver)              # optional for a fresh start
await graphiti.build_indices_and_constraints() # creates indexes once

5. Insert Episodes into Your AI Knowledge Graph

episodes = [
    {
        "name": "About Me",
        "content": "Hi, I'm Pradip Nichite. I am the founder and CEO of FutureSmart AI.",
        "type": EpisodeType.text,
        "description": "intro"
    },
    {
        "name": "About FutureSmart AI",
        "content": "FutureSmart AI builds custom AI solutions for clients.",
        "type": EpisodeType.text,
        "description": "company overview"
    }
]

await add_data(episodes)  # helper loops and calls graphiti.add_episode()

Under‑the‑Hood Workflow

  1. Entity extraction (people, orgs, products)

  2. Relationship extraction (founded, associated_with, …)

  3. Deduplication of entities

  4. Summary + embedding generation

  5. Graph write → Neo4j (your AI Graph Memory)

All steps run via LLM calls you can inspect in your OpenAI usage logs.


6. Visual Exploration of AI Graph Memory

  • Blue = Episode nodes (source text)

  • Brown = Entity nodes (deduplicated concepts)

  • Edges labelled MENTIONS & RELATES_TO connect everything

Run MATCH (n) RETURN n in Neo4j Browser to explore your AI Knowledge Graph. Click any node to view its summary and vector embedding.


7. CSV Export at a Glance

MetricCount
Nodes total9
• Entity5
• Episode4
Relationships total13
MENTIONS8
RELATES_TO5

Sample from node‑export.csv:

namelabelsummary
Pradip NichiteEntityPradip Nichite is the founder and CEO of FutureSmart AI.
FutureSmart AIEntityFutureSmart AI is a company that develops AI solutions for clients and is known for creating AI demos.
About MeEpisodic
AI DemosEntityAI Demos is associated with FutureSmart AI and was founded by Pradip Nichite.
FutureSmart AgentEntityFutureSmart Agent is a product developed by FutureSmart AI.
About FutureSmart AIEpisodic
About AI DemosEpisodic
FutureSmart AgentEpisodic
https://agent.futuresmart.ai/EntityFutureSmart AI is the company behind the product FutureSmart Agent. Their website is https://agent.futuresmart.ai/.

query   = "What products FutureSmart has"
results = await graphiti.search(query=query, num_results=3)
print_result(results)
Search Results:
UUID: dae5cb4d-adb2-401f-991f-aa5259127245
Fact: FutureSmart Agent is a product of FutureSmart AI
Valid from: 2025-08-01 07:54:17+00:00
---
UUID: afc8af04-0af2-4fd8-940a-91cf93da6943
Fact: https://agent.futuresmart.ai/ is the website of FutureSmart Agent
Valid from: 2025-08-01 07:54:17+00:00
---
UUID: c6d353e8-6fb1-4263-a0e9-4df21ea5805f
Fact: FutureSmart AI is the company behind AI Demos
Valid from: 2025-08-01 07:54:08+00:00

Graphiti blends embedding similarity with BM25 keywords to surface relevant facts for downstream agents.


9. Practical Uses of an AI Graph Memory

  • AI Agent Memory for chatbots and assistants

  • Enterprise AI Knowledge Graph for internal search

  • Neo4j Bloom dashboards for leadership teams

  • Light‑weight RAG pipelines powered by graph facts


10. What’s Next?

  • Integrate Graphiti memory into LangGraph / LangChain agents

  • Combine vector store retrieval with graph queries

  • Package everything in FastAPI + Streamlit for a live demo


Prefer video over text?

Watch the full walkthrough here


Need a Custom AI Agent or Graph Solution?

FutureSmart AI helps companies turn raw data into production-ready AI Knowledge Graphs and AI Agent Memory systems.

  • End-to-end Graphiti + Neo4j pipelines

  • LangChain / LangGraph agent integrations

  • Scalable FastAPI & Streamlit front-ends

  • Secure, cloud-native deployment

Want proof we deliver? 👉 See our real-world results: https://futuresmart.ai/case-studies

Book a free consult: contact@futuresmart.ai


Questions?

Drop a comment on YouTube or email contact@futuresmart.ai.

1
Subscribe to my newsletter

Read articles from Pradip Nichite directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pradip Nichite
Pradip Nichite

🚀 I'm a Top Rated Plus NLP freelancer on Upwork with over $300K in earnings and a 100% Job Success rate. This journey began in 2022 after years of enriching experience in the field of Data Science. 📚 Starting my career in 2013 as a Software Developer focusing on backend and API development, I soon pursued my interest in Data Science by earning my M.Tech in IT from IIIT Bangalore, specializing in Data Science (2016 - 2018). 💼 Upon graduation, I carved out a path in the industry as a Data Scientist at MiQ (2018 - 2020) and later ascended to the role of Lead Data Scientist at Oracle (2020 - 2022). 🌐 Inspired by my freelancing success, I founded FutureSmart AI in September 2022. We provide custom AI solutions for clients using the latest models and techniques in NLP. 🎥 In addition, I run AI Demos, a platform aimed at educating people about the latest AI tools through engaging video demonstrations. 🧰 My technical toolbox encompasses: 🔧 Languages: Python, JavaScript, SQL. 🧪 ML Libraries: PyTorch, Transformers, LangChain. 🔍 Specialties: Semantic Search, Sentence Transformers, Vector Databases. 🖥️ Web Frameworks: FastAPI, Streamlit, Anvil. ☁️ Other: AWS, AWS RDS, MySQL. 🚀 In the fast-evolving landscape of AI, FutureSmart AI and I stand at the forefront, delivering cutting-edge, custom NLP solutions to clients across various industries.