Skip to content

Step 06 of 22

Knowledge graphs & memory

Store entities and relationships, and an agent's memory over time. Vectors find similar text; graphs answer "how is A connected to B" and "what changed since". Useful, but often overkill.

The chain of relationships that answers the questionPins: entities, square for organisationsStrings: relationships extracted from documentsNo single document mentions both Acme and the strike, so similarity search has nothing to retrieve. A graph walks the relationships outward one hop at a time (buys from, ships with, docks at, hit by) until it reaches the answer. GraphRAG and memory tools build such a graph by having a language model extract entities and relationships from your documents. Entities here are illustrative.

How to choose

  • Questions about relationships across many documents: GraphRAG-style indexing.
  • Agents that must remember users and facts over time: a temporal graph or memory layer.
  • Plain Q&A over documents: skip the graph until vector search provably falls short.

What to look for

The questions that separate the options, in order of how much they matter.

  1. 01

    Prove you need a graph first

    Graphs help with questions that follow relationships (who supplies whom, which contracts cite which clause) or span a whole corpus (what are the main themes). Build an evaluation set from real questions and run it against hybrid vector search first. If few questions fail for relationship reasons, a graph adds cost and moving parts without much gain: in the GraphRAG-Bench study, LightRAG sent about 100,000 prompt tokens per question to the answering model against under 1,000 for vector RAG.

  2. 02

    Indexing cost and how updates work

    Every graph RAG tool sends your documents through a language model to extract entities and relationships, so indexing costs far more than embedding. Microsoft GraphRAG also writes community summaries and largely rebuilds when documents change; LightRAG skips the summaries and adds documents incrementally; Graphiti ingests episode by episode. Estimate tokens for your whole corpus with your extraction model, then ask what happens when a tenth of it changes next month.

  3. 03

    Time: facts that change

    Agent memory has a problem document RAG rarely does: facts go stale. A user moves house, a policy is replaced. Graphiti records when each fact became true and when it was invalidated, so an agent can answer what is true now and what was true then. Mem0 and most graph RAG pipelines simply add new facts beside old ones, and Cognee's time-awareness is newer. If your agent runs for months, test contradiction handling explicitly.

  4. 04

    Storage backend and what you must operate

    Pipelines and memory layers sit on top of a store. Graphiti needs Neo4j, FalkorDB or Amazon Neptune; LightRAG's in-memory defaults are for testing only and it recommends Postgres for production; GraphRAG writes files and a LanceDB index by default; Cognee defaults to embedded stores but can move to Postgres or Neo4j. Choose a tool whose production backend you already run or are willing to run.

  5. 05

    Extraction model quality and structured output

    Graph quality depends on the model doing extraction. Small local models miss relationships and duplicate entities, and Graphiti's README warns that models without reliable structured output can break ingestion. LightRAG suggests a 30B-class model as a practical local minimum. Budget for a capable model at indexing time and check entity deduplication on a sample before indexing everything.

  6. 06

    Read memory benchmarks with care

    Agent-memory products cite LoCoMo, LongMemEval, Deep Memory Retrieval and BEAM. Almost every published figure comes from the vendor, often for its hosted service rather than the open-source SDK, with different models and settings per run. Use them to shortlist, then score each candidate on a replay of your own conversations, measuring accuracy on changed facts and retrieval latency.

  7. 07

    Licence and open-core splits

    GraphRAG and LightRAG are MIT; Graphiti, Mem0 and Cognee are Apache 2.0; Neo4j Community Edition is GPLv3 and single-server, with clustering and role-based security only in paid editions. Several projects keep key features for their hosted product: Mem0's graph memory is platform-only, and Cognee's production extractor and Postgres graph store sit in a licensed product. Check that the feature you need is in the open edition.

How the options differ

Three different kinds of tool share this shelf. A graph database (Neo4j) is storage: nodes, relationships and a query language (Cypher), now with vector indexes too. It does nothing to your documents on its own; you, or a pipeline, decide what goes in. A GraphRAG indexing pipeline (Microsoft GraphRAG, LightRAG, and the knowledge-graph option in RAGFlow) reads a document collection with a language model, extracts entities and relationships into a graph, and answers questions over it; GraphRAG adds community summaries for whole-corpus questions, LightRAG trades those for cheaper incremental updates.

An agent memory layer (Graphiti, Mem0, Cognee) is built for conversations rather than document collections: it extracts facts as an agent talks and works, stores them across sessions and retrieves the relevant ones later. Graphiti keeps a temporal graph that tracks when facts changed, Mem0 is the simplest per-user memory API, and Cognee builds one shared graph from many sources for several agents. Pipelines and memory layers usually run on top of a store such as Neo4j or Postgres, so the choice is often one of each.

7 tools, compared

Ranked by our rating. Open any review for sources, prices and the full verdict.

Knowledge graphs & memory tools compared
ToolRatingOur verdictBest forPrice
Graphitirepo4.3/5For agents whose facts change over time, Graphiti is the open-source memory layer to beat, provided you will run a graph database and pay for LLM extraction on every write.Teams building long-running agents that must remember changing facts about users, accounts or the world.Free and open source under Apache 2.0. You supply the graph database and pay for LLM and embedding calls during ingestion.
Neo4jrepo4.1/5The default graph store when your RAG or agent memory genuinely needs relationships, but the free edition stops at one server and most RAG does not need a graph at all.Teams whose RAG or agent-memory questions depend on relationships between entities, and who need a proven graph store.Community Edition free under GPLv3. Enterprise by quote. AuraDB: Free tier; Professional $0.09/GB/hour (1 GB minimum); Business Critical $0.20/GB/hour (2 GB minimum).
Mem0repo4.0/5Mem0 is still the quickest way to give an agent a memory, but the open-source SDK is increasingly the trial version of a platform that keeps graph memory and the best benchmark scores for itself.Developers adding cross-session user memory to chatbots and agents.Open-source SDK free under Apache 2.0. Platform: Hobby free (10k adds, 1k retrievals/month); Starter $19/month; Pro $249/month (500k adds, 50k retrievals, graph memory); Enterprise custom.
RAGFlowrepo4.0/5A finished document-to-answer product you can run on one server, whose security record says it belongs behind a VPN rather than on the open internet.Teams that want a self-hosted document Q&A and knowledge assistant without building a pipeline.Free and open source under the Apache 2.0 licence. You pay for the server and the model calls.
LightRAGrepo3.9/5The sensible way to try graph RAG, cheaper to maintain than Microsoft GraphRAG, but most teams should prove they need a graph before adding one.Teams whose evaluations show multi-hop questions failing with hybrid search and who want a graph on Postgres.Free and open source under the MIT license. Indexing and queries use your own LLM and embedding credits.
Cogneerepo3.8/5Cognee builds a shared knowledge graph from almost any source, but its defaults need an owner before they meet production.Teams building several agents that need a shared knowledge graph assembled from many sources.Open source under Apache 2.0. Cognee Cloud: free up to 1M tokens and one workspace, then $1 per 1M tokens plus $5 per extra workspace a month; Enterprise is a quoted BYOC engagement.
GraphRAGrepo3.5/5Still the reference design for whole-corpus questions, but Microsoft has stopped developing it and the indexing bill is as large as ever.Teams with a fixed, high-value document set where cross-document questions justify a costly one-off index.Free and open source under the MIT licence. Indexing runs on your own OpenAI or Azure OpenAI credits, which the README warns can be expensive.

Side by side

The specifications that matter for this step. Checked 2026-10-23; confirm on the vendor’s site before you commit.

Knowledge graphs & memory: specifications side by side
ToolWhat it isStorage backendTemporal awarenessQuery interfaceLicence
GraphitiTemporal agent memory layerNeo4j, FalkorDB or Amazon NeptuneYes, valid/invalid times per factPython API: vector + BM25 + graphApache 2.0
Neo4jGraph databaseNative graph store + vector indexNo built-in fact versioningCypherGPLv3 Community; commercial
Mem0Agent memory layerQdrant default; 20+ vector storesNo proper handling of changesPython/TS SDK: add and searchApache 2.0 (graph is paid)
RAGFlowRAG engine with graph optionElasticsearch (default) or InfinityNoWeb UI, REST, Python SDKApache 2.0
LightRAGGraphRAG indexing pipelinePostgres recommended; Neo4j etc.No; incremental updatesPython, REST: five query modesMIT
CogneeAgent memory layer (shared graph)Ladybug + LanceDB + SQLite defaultPartial; newer than Graphiti'sPython, CLI, REST, MCP: recallApache 2.0
GraphRAGGraphRAG indexing pipelineFiles + LanceDB (default); AzureNo; rebuild on changePython/CLI: global, local searchMIT

Connect it to your agent

MCP servers that let assistants like Claude, ChatGPT and Cursor use these tools directly.

Where this stage fits

Sources for this guide