Enjoying this issue?
Get tomorrow's AI & engineering digest in your inbox — hand-picked, summarized, and always spam-free.
TLDR
Graph engineering, as defined by Neo4j, is the practice of designing agent work as an explicit graph where nodes do work and edges route state. The key insight is that procedural knowledge—compiled from past decisions or documentation into a graph structure—can be stored as a portable artifact in a knowledge layer, separate from the runtime, enabling agents to run governed, predictable workflows with significantly lower cost and latency. Neo4j's demo showed a loan approval task dropping from 7.5 minutes to under 2 minutes and cost reduced by roughly 100% by replacing an agent's free-form reasoning with a compiled graph skill.
Key points
Graph engineering is the practice of designing agent work as an explicit graph.
Neo4j compiles procedural knowledge from written material into a graph structure.
Compiled graph skills can be stored in a knowledge layer and ported between runtimes.
A loan approval demo reduced runtime from 7.5 minutes to under 2 minutes.
Using a compiled graph skill allowed a simpler model (Haiku) and cut costs significantly.
Tools mentioned
Techniques
- graph engineering
- compiling procedural knowledge into graph structures
- context graphs
- procedural graphs
- skill compilation from memory graphs
Stop scrolling. Start reading smarter.
Receive the day's most important AI & engineering updates in one concise email. No spam.
Transcript (captions)
[music] Uh we're going to talk about graph engineering today. How many people have heard about that term graph engineering? Okay, so so fair amount of the room. And
then just so I understand, how many people here are familiar with Neo4j and have used Neo4j? Okay, so we got a few people. So that's good for uh
just letting me know who we're talking to today. Um so just some history on some of the verbage that's being used. Uh there was a tweet that went out by Peter
Steinberger, I think earlier this year in the summer, uh that talked about graph engineering and it was almost like is this sort of a new discipline that's happening as this
evolution from prompt engineering and context engineering. Uh and there's a lot of hype around this. Um and the name for this is new, but the mechanisms are not really new. They
we've always known in computer science generally about state machines and workflow graphs and knowledge graphs and all these different things. What's changing is really how we think about
them in reference to agents. Um and what I'm going to talk to you about today is just how we think about graph engineering. I'm going to offer you a little bit of a new perspective on
this. So if we actually try to define what graph engineering is, I think a good definition is it's just the practice of designing agent work as an explicit graph. So where nodes do work
and edges effectively route state between them. And I tend to think of it in terms of three different types of graphs. We have our general execution graphs, which you're probably very
familiar with. So these are the workflow graphs with routers and agents as actual nodes that happen within side of an agent harness. But, there's other ways that we can think about graph
engineering, too, that overlap with this. So, that includes context graphs. These are decision traces, instances of what's happened, and how it connects to other data inside of your domain. And
then there's also something that I'd call more procedural graphs. So, this is almost like having a skill or procedural knowledge as a graph, where the steps might not be actual agents, but they
might be steps inside of uh uh a way of doing something, basically a procedure. So, different calls, maybe a step for a decision model, steps for different agents, whether to escalate,
validation steps, and these sorts of things. And I'm really going to focus on these last two, because I think we don't talk about them enough, and I think by
understanding these, you can actually get a little bit at what the first graph is trying to do as well, but in a very portable and efficient way. So, graph engineering lets agents really
take on bigger, more complex work, and that's why we care about it. And really, if you were to split it up, I think in terms of the benefits that a graph offers agents in this uh context, it
would be predictability so being able to constrain a path that an agent takes, making sure that the the answer is basically accurate from a task that it's doing um and having an explicit graph,
the ability to govern, control, and guide what the agent does, and audit it, so you can understand what it's doing and make it better next time. And then the third one, which is going to be
interesting that we'll talk about, is how do we actually make graph engineering portable? And instead of thinking about a graph as something that happens in the runtime, it could be
something that you can store and actually move between different runtimes and have inside of a knowledge layer, which gives you more interoperability and allows you to have a very simple
stack. Um and in the runtime, when we think about the graph, it's really like a piece of orchestration. So, we're probably all of us or a large portion of
us are probably familiar with LangGraph, ADK, um and all these other agent frameworks. Um even to a certain extent Anthropic's multi-agent research and and some other
stuff fits inside of graph engineering. Um and what I'm going to talk about today is actually what happens when we take that sort of graph and we put it next to our data as context graphs and
some other things that I was talking about before. Um and really when you do this, as I was saying, you add this portability layer, you add the ability to take all of this
knowledge and make it work basically with any type of runtime. So, that's what I'm going to go over today. Um and this is what we're doing at Neo4j is we're defining this knowledge layer
and this knowledge layer sits between systems of record that you would ordinarily retrieve data from. So, Data Bricks, BigQuery, Snowflake, these types of places. It could be documentation, it
could be Obsidian, these these markdown files. Um and then can we create standard protocols and artifacts that live inside of that layer that then you can take a graph engineering process and
make it available to any runtime or any agent. Um and the way our product works, just so you know at Neo4j, uh is we have our core database and then we have a ton of
other AI stuff on top of it. Uh so, the database and the analytics layer, um I'm going to be showing some of this throughout my talk, uh but what I'm really going to be focusing on is this
top layer where we talk about sort of this agentic brain or these other memory tools that wrap around the database. So, just know that as I go through, I'm going to be showing you data being
loaded into the database. That's going to constitute our knowledge layer. It's going to come from multiple different sources. Um but a lot of the sort of extensions of that tooling and some of
the experimental things that I'm going to show you exist as sort of this graph AI that hooks into that and loads data in and out of that thing. [snorts] Um, so, what we're doing at Neo4j, and
kind of how we're thinking about this: we start with this concept of a context graph, which has different types of memory from short-term memory which is going to be like your conversation
history your long-term memory, being entities that are extracted from that or from your data, and then reasoning or decision trees inside of that. And one of the interesting things that
we've been looking at from a research perspective, and this really started out not so much at that graph, but actually at individual skill level. There was a paper that we wrote earlier this year
that we published in a workshop, and we were really trying to ask the question, can we take procedural knowledge, whether it be from past decisions or even something like a skill like we have
here, and compile it down to a graph? And what we came up with was a process of taking written material, often a skill MD file, and the scripts and the references and assets, and moving that
into an actual graph structure, which is what you see on that other side. And the result of doing this and giving the agent the access to that graph structure, which has different nodes
again representing inside of the skill decisions, different routing points, different scripts that have to be executed, taking pros and compiling them down to
to determine the six scripts. When we do that and we force the agent to sort of run that graph, what we see is increases in uh task reward and performance. So, this was uh from a
while ago. I I'm still [clears throat] working on updating it to the latest models, um but we were able to use a smaller model.
In this case, I think it was Sonnet, um, and now we're we're on to Haiku, as a matter of fact. But, uh, we were seeing, even for really challenging tasks over diverse fields in physics and computer
science and, um, various security, uh, physical training, a whole a whole ton of things, um, is this overall increase in task reward,
um, performance. Then we were able to switch over to this. And our PMs, uh, Will Lein, who works in our Labs team, actually took this idea
and said, "Well, if we can do that with skills, maybe we can do it, too, with these memory graphs." So, you can actually take that context graph that I was showing you earlier and distill a
skill from that and have it still be connected in the same graph over to all of your past decision traces and data. And so, then you get those performance benefits, but you also have all this
provenance that goes back from every step. It's versioned, it's tracked, and you have governance over time where you can assess drift, you can understand where certain tool calls are coming from
and their history. A human can go through actually inside of NAMS, Neo4j Agent Memory Service, which is our reference architecture for this. There's a QR code there, and there will be
another one at the end, um, and be able to understand, like, exactly how this works, edit it, change it, do all sorts of cool stuff with it. Um, so again, what we're talking about now are these
artifacts that you can move around. I mean, this thing makes a skill, right? And so, any agent harness that can take that skill can now be running these graphs and doing all of this logic.
Um, and we have various customers that are using us for graph engineering types of tasks. I'll go quickly because we're we're starting to run out of time. Um, and even though they're not may not be
using exactly the Labs project that they that we have, uh, we have consultancies which are working with other asset managers, uh, for tough problems in compliance. Uh, so being able to write
audit reports, for example, where you have data that might come from multiple sources. How do you automate that, but do it in a way that's governed and trustworthy? So, you have compliance
documentation. You might have entities with different ticker symbols and names from different databases, and those all need to be resolved. And so, giving your agent these graphs that express the
logic that you need to do on besides the data basically allows you to automate those things in a trustworthy way. Um and we have other people uh such as Uber that do this with configuration
graphs. Uh, so basically, if you have, um, you can imagine if you have drivers across the country, uh, compliance and regulations for different areas geographically vary greatly, um, and
they come from this sprawl of microservices that you need to pull data from to figure out like, "Okay, well, what is it for each area, for each component of a car, for example?" Um and
so being able to express that logic and have it sit aside the data um also helps them operationalize some of these things effectively. So, I'm going to jump to a demo now. It
I'm going to warn you in advance: it's going to be quite a lot, and I'm going to jump through it kind of quickly, um, but it's very interesting. And what I'm going to show you is how we can use that
AIP library that I was talking about before, uh, to compile a skill and actually get a task that was not governed very well and took very long to run, basically cut
its cost by like 100%and then run it a lot, lot faster. Um and of course, it's uh it's a demo, it's not a formal research proposal, but you can go there and look at the code. It's all It's all
very transparent. Uh so, this is going to be an example for a loan um a loan approval process. So, in a side of a loan approval process,
there's lots of policies that have to be followed, obviously. I'm not a financial expert, but many of you in the room are. Um and so there's probably going to be a policy doc. There's going to be a
systems of steps that have to be followed exactly, and then you need your agent to be able to explain those steps very clearly, articulate them, and really get the answer right as if it was
a human reviewing. Um and the first thing you can do, like I was saying before, and I don't have time to probably run this all live, and the internet's going to be slow. So, luckily
I I have this preloaded. Um and basically, the question that was asked was should we approve this new loan for this Rosa's Bakery business? And in this case, you know, we have a business plan
that's in a PDF that was uploaded. Um and that is, let's see, um the business plan is the orange data. So, if I was to scroll out here, you can see it here in the graph. That connects
also to data that we pulled from Data Bricks, from past transactions, lending policy data, and past decisions that were actually made. And with that, the agent can crawl over all that
information and basically realize that this person either had a loan before or there was a mistake before, something happened before, and come up with an audit trail for that and basically post
a solution uh very, very quickly. [snorts] Um and this is a great start. Just in terms of like resolving data and being able to follow policies and understand how things connect, uh this
is great. One of the issues with this is, and I can show you a graph kind of of what this looks like. This is an example of me running more of these policies.
Um and if I zoom in, I have a conversation here. And then I have my my reasoning trace that exists inside of this graph. And all of these steps are time-stamped and they have tool calls.
Uh what can happen is if I uh look at this happening twice. I think this is the right query.
Um this is this is two decision chains. It's going to be a little bit hard to see. Let me zoom in. Um they they're of different lengths, you'll notice. So, one is longer than
the other. Um in this case, it was cuz it found a precedent in one. Um basically, something else that had happened before. But the the problem with this is that if
you run these over and over again, there's nothing actually like enforcing that the agent follows an exact path. You might have a skill or something that will say like do these things. Uh but
then there's other problems where it's like there's these decision steps where it's approve or deny is a simple one, or approve it or send to a human to review. And those decision steps as well come
with confidence scores. Uh or you say like if you're confident about it, if you're not confident about something, but those decisions aren't calibrated. So, it would be great to
like even take some of this and send it to something like a type safe, you know, Jev type of model as well to be able to do some of those things. So, what you can do is you can scrape
all of this and you can compile it into a graph shape skill, which is what we did here. And that graph shape skill, if I go here, you're not going to be able to see
it. But that's okay that you don't see a lot of the detail here. The important part is that we sort of compiled all the information down from those successful runs that we did, even
though they were a little bit inconsistent, and we put them into this graph YAML shape inside of this skill. And this skill, even though you probably have trouble seeing, has scripts, it has
assets here, it has sometimes other reference resources. It doesn't for this one. It also has source documentation around the policy that you're supposed to do
for the loan. So, there's So, there's basically a ton of stuff in here for traceability, but then also telling the agent how to run the skill. But the great thing is once the skill is in this
YAML format, we can port it into all this different tooling, including inside of a graph, cuz it's all sort of this deterministic format. And in a graph, it looks kind of like
this thing here. So, let me Actually, let me just run this run this sucker again. Um This is kind of what it looks like. So, you have all of these steps out here,
and then basically what I just did is I wrapped the small cli around this, so the agent can say, "Hey, run the skill." And instead of the agent deciding all the routing steps, it's just done
programmatically. We took a lot of that policy down, and we put a lot of it into these execution scripts. Basically, what's happening here, if if
I was just to sum it up, there's an execution that basically looks at, "Hey, do do we meet certain hard rules around policies?" After that, it's routed if it's not auto
approved or denied based on that, it's routed to a decision model like Javelin type safe. Um, and I can even probably show you a little bit of a clearer view here.
Um, and it's given that that model is given like a risk tier choice. Um, let me make that a little bigger. Hold on. Um, whether or not there's there's some
exposure material and then like an outcome of whether or not you're approving or denying. And then the rest of this um, will basically follow down into writing a
report, whether or not you need to escalate to a human review as this router. And then if not, basically the agent is going to write a report and there's a circulation here to sort of
check and lint that report. Um, so once you do this and you sort of get the model going where okay, well now we have this cli that we can just run this thing in.
Um, well now I can go in here and then maybe I can probably don't have time to run this whole thing again, but I will give it a shot. Um,
I'll see if it goes and picks this up. It takes about 2 minutes to run. Uh, but the idea I guess while this is running and it should pick up the AIP scale which which it is here.
Um, once you have it in this format, not only can you have the agent run this very quickly. Uh, you can track the runs. So for
example, um, if I was to look at a single run, I can run this again. I can basically persist the runs inside of the graph. Um, so this is a run of that scale with
like individual steps that it ran. Um, and then uh, I can just persist these over time. I can examine how well they work. So from a governance perspective, um, I have a little
inspector here that I built really quickly. You can look at the status of all these. You can look at how a specific one ran, what was approved, what was denied inside of the process,
what branches it took. Um, and then once you have a graph, you can even do these cool observability things where you can ask, well, like what branches were taken and which
branches weren't taken. Um, which is very interesting from a governance perspective it failed ever [snorts]. Um, all these cool different things, and
all of that is stored besides your data. Um, and so in none of this, we're not like creating a loop, right, inside of our agent. All we're doing here is basically giving it a cli to run this
like programmatic skill that we compiled from documentation or in this case from our memory graph. Um, and this might take a while to run just because of the the internet.
But what I will show you is I we ran this a few times. Um, and what we saw is just running I was using Fable so my organization already yells at me for this enough so
I'm spending a bunch of money. Um, but like just using Fable alone on the graph and it was correct you know, pretty much every time but it took 2.7 minutes. When we had the procedure
it almost cut in half just using AIP and then because we had the procedure we can use a simpler model like Haiku and then we can cut the model time down even more and then of course, you know, the cost
just goes way down. So, cuz you're taking all of that load, right, of having to figure out all the routing, all the stuff you're doing, you're putting into these execution scripts,
these Java models and everything, um which makes everything just much, much more efficient. Um, and this is going to take too long to
run. Uh, it's mostly internet. You can see here about half a minute or 2 minutes wall clock on average down
from like 7 and 1/2. All right, so anyway, um, I'll end it here. So I want to give you some resources to check out if you're interested in this type of stuff. Aura
is our cloud service offering where you can get the database that I was showing you before. You get $100 of free credits. We have nodes coming up which are is speakers event. There's a startup
program and then all the code that I was referencing in the other projects that I was using to hook up to your agent memory, all that sort of stuff is down there. So, I'll leave this up for a
second until someone kicks me off, and I guess that's it for me for now.