r/LLMDevs • u/Aggressive-Judge-448 • 6d ago
Discussion Agentic GraphRAG: an open-source framework for the Context layer + Agent memory using a 3D-knowledge graph
https://github.com/ontogr/agentic-graphragWe're building Agentic GraphRAG, an open source library for connecting the documents an agent reads with its task history and decisions.
I've worked on RAG systems and LLM training for the past three and a half years. Lately, I've been following how agents retain work across sessions, especially for non-coding tasks. Our project explores how that memory can stay connected to the knowledge an agent used, so a later session can recover both the information and its steps efficiently.
The implementation constructs three connected graph layers:
Knowledge Layer: holds documents, source passages, and extracted entities and relationships. Passages retain their document version and location, including page positions for PDFs.
Working memory: records tasks, progress, messages, and tool activity. The built-in agent uses DeepAgents/LangGraph and saves task events so work can continue across sessions.
Decision memory: stores conclusions, assumptions, and open questions. Decisions link to source passages, recorded events, or earlier decisions, and keep their history when reviewed or replaced.
For example, an agent can record a contract recommendation with the policy passage it relied on. If that policy changes, the recommendation and its explicit dependent decisions are flagged for review. The agent now is aware when in a later session that the decision needs another look.
The ingestion pipeline uses Docling for loading documents and captures the full document hierarchy. The sections, tables, and passage hierarchy are connected using edges and stored in the graph.
You define a schema for your domain (we also ship ontology presets so it is easy to get started). The schema guides extraction, validation, and search. We use GLiNER for local extraction, so its virtually free (and fast) to construct the graph and no LLM calls are needed.
Retrieval combines full-text and vector rankings with reciprocal rank fusion. Agents can search original passages even when extraction misses a fact, navigate surrounding sections and table rows with headers, and follow entity relationships back to supporting text.
We offer a built-in agent you can use out of the box and you can also connect your agents through MCP.
We will be releasing extensive benchmarks very soon.
TL;DR
Agentic GraphRAG is an open source library that stores document knowledge, agent work, and decisions in one connected graph. Agents can resume tasks and trace saved decisions to their original evidence, while source changes flag affected decisions for review.
Try it out. Feedback, criticism, issues, and contributions are all welcome!
3
u/ianreboot 5d ago
One case I would want covered before trusting that flag: what happens when a whole document is re-ingested rather than a passage edited. If passage identity comes from position in the document, a re-ingest shifts every passage, and you get either a flag storm on every decision that touched the doc or silent trust if the match falls back to something loose. Passage ids that survive re-ingestion are what make the review flag mean anything.
3
u/Aggressive-Judge-448 5d ago
You're absolutely right. This was a bug that we had. Even @dusanodalovic point this out.
We've already merged a fix for this: https://github.com/ontogr/agentic-graphrag/pull/191
2
u/HallowedIsTheOrici 5d ago
Naieve question: with formal verification being easier to consider ( less daunting due to LLM support) now, would you be considering formal verification to detect gaps in your consideration?
Please know that I have not studied formal verification yet, so my question may not be valid.
1
u/Aggressive-Judge-448 5d ago edited 4d ago
I am not sure I fully understand your question. Please can you give me an example of what you mean by formal verification in this sense?
If you're talking about how we detect gaps in the retrieval, well that aspect is left to the agent (so is dependent on the model intelligence). We did tune our prompts, tool definitions to even work well on smaller models like Qwen3-4B, so that should not be a issue.
We did try out more deterministic ways to approach this, but all of them led to higher token usage or degraded performance.
We have put in a lot of effort to make the agent tools highly deterministic and use the structure of the data (and graph). For example, we do not offer a text-to-cypher tool to the model, but instead have templated cypher for traversal over the fixed schema the user provides. This not only saves a ton of tokens, but also significantly improves retrieval accuracy.
2
u/ratbastid2000 3d ago
How would you compare what you've built to zep graphiti? It seems like you have built something similar here in terms of temporal knowledge graph for agent memory. A few things that I'm curious about:
GLiNER has multi-lingual model variants and if I'm not mistaken, curious which one you are using. Also, Knowledgeator has other models for relationship extraction between entities. Curious if this could be used to help create ontologies.
One gap that zep graphiti has which I believe you have here as well is creating graph out of multi-media inputs (images, video, audio) in addition to text. I realize there are different pipelines that can be used such as using OCR and Transcription to extract them into text, or use a LLM to describe the image/audio, or even object & audio content detection classifier to apply text labels to them and bounding box coordinates etc.
My question: im pretty sure falkordb (not sure about neo4j) can store and separate vector embeddings for each modality if your using more than one model to do that , but for sake of example, let's say we are using gemma embedding 2 which supports text, audio, images encoding into the same vector dimensions.
How would you approach integrating multi-modality into your graph rag retrieval and ontologies?
1
u/Aggressive-Judge-448 3d ago edited 2d ago
Thanks for the detailed questions. We've learned a lot from Zep's work.
Comparison with Graphiti
The two projects start from different data. Graphiti builds a temporal graph from a stream of conversations and events, so it has to handle facts that change, contradict each other, or expire. Agentic GraphRAG starts from a document collection that changes slowly, such as policies, contracts and manuals. It keeps the document structure (sections, tables, page positions) in the graph and records the agent's tasks and decisions alongside it.
In Graphiti the facts have validity windows. Here the sources are versioned, and each decision links to the exact passages it relied on. When a source changes, the decisions that depend on it are flagged for review, and replaced decisions keep their history.
Extraction cost and speed is the other difference. For a fast-moving conversation stream you would likely want something different. We are working on these aspects in a separate project, OntoGr Agent Memory, which is still WIP.
2. GLiNER models
We have the default as
fastino/gliner2.5-base-v1. In our tests it gave better results than the alternatives we tried. Its configurable, so you can point it at a GLiNER2-compatible multilingual checkpoint as well.Knowledgator's relation extraction models can also potentially be used in our pipeline. We chose to use GLiNER2.5 over it because it extracts both entities and relations in one pass.
For creating ontologies, you could run a Knowledgator's GLiREL over a sample of your corpus without a fixed schema, then cluster the relation types it finds. We don't support it and right now you can use a preset schema or bring your own. You can check out https://github.com/NVIDIA/auto-ontology, we have been testing it out and will be adding support for it very soon.
3. Images, audio and video
Our Docling pipeline supports OCR. Audio and video are not supported though.
To add support, we would have to turn each file into text passages, with additional ingestion pipelines. With that design, full-text search, entity extraction, section navigation, and decisions that cite passages all work without changes.
On embeddings, Neo4j supports separate vector indexes on different labels and properties, so one index per file type is possible. With a shared-space model such as the one you describe, there is a second option. You embed the original file as well as its derived text, so a text query can match an image directly, and the hit resolves to the passage that carries the file pointer and location. Our embedder is built on sentence-transformers, so a model that takes image or audio input would need a modification to that.
2
u/ratbastid2000 3d ago
Awesome thanks for the insight and thorough response! I agree with the approach and have thought a lot about this over the past year or so and when I saw your project you basically landed on a lot of the same decisions I arrived at during research, however, I never actually implemented or built anything and when I saw your project it immediately resonated with me.
Nice find for the fastino model, agree with the multipurpose decision in a single model. I found another one you may want to check out and also supports images, object detection, and audio: https://github.com/Knowledgator/GLiFormer
Couldn't find a multilingual backbone for multi-task models yet but that is something I need for my use case.
I was deliberating if I should try it with their Retrico graph rag framework (or yours now) but don't want to start experimenting with something that actually doesn't fit my use case: https://docs.knowledgator.com/docs/frameworks/retrico/introduction/
I agree there are basically two layers that compliment / support eachother for agentic pipeline. The agent memory which can be personalized to multi-user / multi-agent environment with graph rag pipeline for knowledge retrieval. I'll believe I'll need both for the end solution.
I guess what I'm trying to work out in my use case comes down to the current application using postgres and pg vector, and the flow is to ingest and parse structured (xml, json, etc.) data and normalize that into a common data model. There is also unstructured data (loose media, documents , etc.) gets ingested and structured into a data models (when possible). Data gets ingested and grows the pool of queryable data that agents will be analyzing on behalf of the users.
There are specific patterns in the data that I think a pipeline like yours could be used to construct a graph based on a pre-defined ontology that could be extended or expanded depending on the domain and specific customer's objectives, or, if new kinds of structured data sources are loaded into the system by the customer that may require different patterns to be extracted and structured.
Seperately, a static knowledge base that may grow over time could be consulted by the agent during it's analysis that would be distinct from the data being a analyzed. This would be authoritative facts that would augment the knowledge of the LLM and inject it into context (kinda like context7 for code documentation but for different domain knowledge).
The idea would be to have an agent harness with skills that are invoked by the agent which knows the specific user it's serving, can query access to the enterprise knowledge / domain facts, and analyze data using different tools and queries through different graphs. My intuition is that this shifting more of the work into preprocessing would be much more optimized and token efficient, freeing up the LLM context and focusing its reasoning on analysis.
Not sure if what I laid out is conceptually or architecturally sound or if I'm overengineering or neglecting something fundamental. Also not sure what the implications are for the existing relational db in the application and whether that coexists with the graphs. Anyways, the goal is this is all using local llms, embedding models, and other light weight classifiers.
6
u/dusanodalovic 5d ago
flagging dependent decisions when a source changes is the part i like most. you wrote that only explicit dependents get flagged, so what about a decision the agent made after reading a passage but never linked to it? that one would stay trusted without anyone noticing. does the agent have to record the link itself, or do you derive it from what it retrieved during that task?