█

AI/TLDR

Buy me a coffee
Buy me a coffee

graph-rag-agent

A Neo4j knowledge-graph Q&A system that fuses GraphRAG, LightRAG-style search and DeepSearch reasoning agents

RAG Frameworks & PlatformsOpen source
Language
Python
License
MIT
IN SHORT

What is graph-rag-agent?

graph-rag-agent is an open-source Python project that combines GraphRAG with private-domain DeepSearch to build an explainable question-answering system over your own documents. It sits in the RAG Frameworks & Platforms category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed MIT. To get started: start Neo4j.

Overview

graph-rag-agent is an open-source Python project that combines GraphRAG with private-domain DeepSearch to build an explainable question-answering system over your own documents. It reimplements GraphRAG's core ideas from scratch and borrows from Microsoft GraphRAG, Neo4j's llm-graph-builder, LightRAG and Zilliz's deep-searcher: an LLM extracts entities and relationships from your files, the result is stored as a knowledge graph in Neo4j, and a set of agents searches that graph to answer questions.

The project ships as a full stack rather than a library alone. A graph-building pipeline ingests TXT, PDF, Markdown, DOCX, DOC, CSV, JSON and YAML files, runs community detection (Leiden or SLLPA) with summaries, and supports incremental updates with entity disambiguation and alignment. A FastAPI backend serves several agents, and a Streamlit frontend shows streamed answers, the reasoning trace, the matched sub-graph and the source text in a debug mode.

The graph-rag-agent Streamlit app in debug mode, with a hybrid_agent answer on the left and the knowledge sub-graph used for that answer on the right.
Debug mode shows the answer beside the part of the knowledge graph it was drawn from.graph-rag-agent README ↗

It is aimed at developers who want to study or deploy graph-based RAG end to end, including evaluation: a built-in evaluation framework covers answer quality, retrieval performance, graph quality and deep-research results with more than 20 metrics. The README is written in Chinese and its sample knowledge base is a set of university student-management rules, which you replace with your own files and entity/relationship schema.

What it does

  • Knowledge-graph construction in Neo4j with LLM-driven entity and relationship extraction from TXT, PDF, MD, DOCX, DOC, CSV, JSON and YAML files
  • Incremental graph updates (one-off or as a background daemon) with entity disambiguation, entity alignment and built-in consistency checks
  • Community detection with the Leiden or SLLPA algorithm plus generated community summaries for global search
  • Several agents: NaiveRagAgent (vector retrieval), GraphAgent, HybridAgent, DeepResearchAgent and FusionGraphRAGAgent, the last built on a Plan-Execute-Report multi-agent architecture that plans tasks, runs retrieval, research and reflection workers, and writes long-form reports
The knowledge-graph reasoning tab finding a relationship path between two entities and drawing it as a small graph.
Graph reasoning: find the one- or two-hop path between two entities.graph-rag-agent README ↗
  • Local, global and hybrid graph search, Chain of Exploration over the graph, evidence-chain tracking and a visible thinking process
  • FastAPI backend with streamed responses and a Streamlit frontend with a debug mode, an interactive Neo4j-style graph view and entity-path reasoning, plus an evaluation system with 20+ metrics

Getting started

These steps follow the project's quick-start guide (assets/start.md). You need Docker for Neo4j, Python 3.10, and an OpenAI-compatible API endpoint; the guide suggests routing requests through a One-API or New-API gateway.

Start Neo4j

The repository includes a Docker Compose file for Neo4j. The default credentials are neo4j / 12345678.

bashbash
cd graph-rag-agent/
docker compose up -d

Create the Python environment

Install the dependencies into a Python 3.10 environment, then install the package itself in editable mode.

bashbash
conda create -n graphrag python==3.10
conda activate graphrag
cd graph-rag-agent/
pip install -r requirements.txt
pip install -e .

Configure .env

Copy .env.example to .env in the project root and fill in at least the model and Neo4j settings. The base URL points at your OpenAI-compatible gateway. Entity types, relationship types and the graph theme are set separately in graphrag_agent/config/settings.py.

texttext
OPENAI_API_KEY = 'sk-xxx'
OPENAI_BASE_URL = 'http://localhost:13000/v1'
OPENAI_EMBEDDINGS_MODEL = 'text-embedding-3-large'
OPENAI_LLM_MODEL = 'gpt-4o'

NEO4J_URI = 'neo4j://localhost:7687'
NEO4J_USERNAME = 'neo4j'
NEO4J_PASSWORD = '12345678'

Build the knowledge graph

Put your source documents in the files/ folder, then run the full build. The incremental script applies later additions and removals, once or as a daemon.

bashbash
cd graph-rag-agent/
python graphrag_agent/integrations/build/main.py

# incremental update, once
python graphrag_agent/integrations/build/incremental_update.py --once
# or as a background daemon
python graphrag_agent/integrations/build/incremental_update.py --daemon

Test the agents from the terminal

The test scripts query the agents with and without streaming; comment out agents you do not want to run to keep it fast.

bashbash
cd graph-rag-agent/test
python search_without_stream.py
python search_with_stream.py

Run the backend and frontend

Start the FastAPI server, then the Streamlit app, and pick an agent in the sidebar.

bashbash
cd graph-rag-agent/
python server/main.py

# in another terminal
cd graph-rag-agent/
streamlit run frontend/app.py
The graph-rag-agent chat interface outside debug mode, with an agent picker in the sidebar and a structured streamed answer.
The chat view with the agent picker and example questions in the sidebar.graph-rag-agent README ↗

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

When to use it

  • Build a question-answering assistant over an internal rulebook or document set where answers depend on relationships between entities, not just similar text chunks
  • Compare naive vector RAG, graph search, hybrid search and DeepSearch-style multi-step agents side by side on the same knowledge base
  • Inspect how a graph-RAG answer was produced, with the execution trace, matched sub-graph and source passages visible in debug mode
The debug panel's source-content tab showing the original document passage behind an answer.
The source-content tab traces an answer back to the original document text.graph-rag-agent README ↗
  • Evaluate a GraphRAG pipeline with ready-made metrics for answer quality, retrieval, graph quality and deep research

How graph-rag-agent compares

graph-rag-agent alongside other open-source rag frameworks & platforms tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Dify★ 162kAn open-source platform with a visual workflow builder for creating LLM and RAG applications without writing much code.
graphify★ 155kTurns a folder of code, docs, PDFs and images into a local knowledge graph with tree-sitter AST parsing and Leiden communities — queryable by agents over MCP, no vector store.
RAGFlow★ 95kA RAG engine built around deep document understanding that turns complex files into a grounded, citation-backed question-answering layer.
Context7★ 65.7kContext7 pulls current, version-specific documentation and code examples for any library and feeds them into your LLM, available as a CLI skill or an MCP server.
Pathway★ 61.9kA Python framework with a Rust streaming engine that keeps ETL, real-time analytics and RAG pipelines continuously up to date as source data changes.
LightRAG★ 41kA graph-based RAG system that builds an entity-and-relationship knowledge graph for fast retrieval and easy incremental updates.
PageIndex★ 40.8kPageIndex turns long PDFs into a table-of-contents tree and uses LLM reasoning to retrieve relevant sections, with no vector database and no chunking.
graph-rag-agent★ 2.4kA Neo4j knowledge-graph Q&A system that fuses GraphRAG, LightRAG-style search and DeepSearch reasoning agents