How to Build a GraphRAG System with Python, Neo4j, and ServiceNow
Published: September 19, 2026 Β· #AI
Somewhere in your company's ServiceNow instance is the answer to the question an engineer asks at two in the morning: if this is broken, what else is about to break?
Every fact needed to answer it has already been written down, correctly, by somebody doing their job properly. Getting it out still takes twenty minutes of opening one record at a timeβand at the end, you can't be sure the list is complete.
This guide is about closing that gap, and about measuring whether it really closes.
What This Project Builds
You'll take a free ServiceNow developer instance, load a company's worth of servers, services, incidents, changes, problems, and knowledge into it, and read it back out with Python.
Next, you'll model that estate as a graph, load it into Neo4j, and build eight different ways of choosing which records to put in front of a language model.
Then you'll score all eight against thirty-nine questions. I wrote and hashed those questions before any of the retrieval code existed, so nothing in the project could be tuned to them.
What You'll Have at the End
- Your own ServiceNow instance holding 11,891 configuration items and 68,900 tickets.
- The same estate modeled as a Neo4j graph, with 28,694 dependency edges.
- Eight retrieval methods you built yourself, from plain keyword search to a walk through the graph.
- A language model answering from that retrieval, running on a GPU you control, so the ticket text never leaves it.
- A results table showing which method actually found the right recordsβand a list of the fourteen things that table can't tell you.
What You'll Learn Along the Way
- What a graph database is for, and when it beats a relational one.
- How ServiceNow's CMDB stores dependencies, and why that makes a three-hop question expensive.
- What retrieval means, and why it decides how good every answer is.
- How to build a comparison framework that tests each retrieval method fairly.
- How to keep sensitive ticket data local by running inference on your own hardware.
- Where the limits of any retrieval benchmark lie, and how to report them honestly.
About the Author
RONI DAS β View profile
This article was originally published in the AI section.
via FreeCodeCamp
