[SPEAKER_00] Hello, good evening developers.
SPEAKER_00
How is everyone doing? Welcome to AI Engineer and welcome to the Neo4j context graph session number two. Excited to be here together with my peer at ABK to share with you more about context graphs, how they can help AI agents to become more decision aware. So one of the big challenges that we are trying to solve these days in the AI era is using knowledge graphs to unlock AI where we want to use graphs to fill the gap of knowledge, give AI agents the right tools and enrich them with the right content to solve certain challenges.
SPEAKER_00
So we all know that AI agents are really good in language, reasoning and creativity, but we want to fill the missing puzzle piece of knowledge for the agents. A big topic we have been discussing, we also saw before at Steve's talk, is memory. We talk about different types of memories: short term, long term and reasoning memory. In short term memory, we try to understand and capture the conversations that a user had with an AI agent. In long term memory, we capture more contextual knowledge, in this case, things around organizations, people and things. That gives us more of a generalized overview of the context.
SPEAKER_00
And of course we need reasoning here, helping the AI to make the right decisions to achieve a certain task. We saw also that for the background of this, we need a graph. A graph is made out of nodes and relationships to help you understand the deep and complex relations and connections between different types of data. So the big question is now why context graphs? We also have been talking lately a lot about context engineering.
SPEAKER_00
Now the big ask again is why context graphs? We are still within the sphere of context engineering when we talk about context graphs, but context graphs really represent a shift of having AI agents that already are very good at providing knowledge to their users, having the right tools and content and context. But with context graphs, we would really like to provide additionally to the knowledge the right rules and policies to the agents to help them become more capable to drive decisions. So not only knowledge, but also decisions.
SPEAKER_00
That's why we're moving not only to how an agent or what an agent can do, but also now we want to really capture within a context graph the missing why. So why an agent needs to do something. And this is something we capture with data that focuses on policies and rules. When we talk about Neo4j, we say also that graphs are everywhere. This is a basic replica of an organization. Each organization is basically also reflected here from the finance department to product to suppliers and so on and so forth. We saw also a good example by Steve before on financial services. So, is someone eligible to get a certain amount of money here.
SPEAKER_00
Yes or no. As part of this chapter, we are really going deeper with our customers and verticals to understand their needs and basically how we can help them solve the why question and help them drive better agents that can be more decision aware. This is also how a memory graph would look like. If we want an agent to also drive the right decisions, we need to give them memory capabilities. This is a quick overview of how the memory graph would look like. In green, we see the short term memory. We are capturing the conversations and the state history. In long term memory, we see more of a generalized overview of organizations and people.
SPEAKER_00
And most importantly, we also have the reasoning. So why an AI agent should do a certain task based on predefined policies and rules. Behind the story is always our foundation. If we would like to build Agentic GraphRag applications, we always have the AI agent where the user sends a query first. The agent looks for this knowledge or for this topic if it's available in its knowledge source. If not, we jump to the graph database. We have a certain set of tools like text to cipher that translates human text to our query language and then we traverse the graph for the right content and hopefully come back to the user with more reliable and qualitative content.
SPEAKER_00
So, Abike, you have been building a decision framework in the last couple of days. Let's have a look at that. [SPEAKER_01] Sure, thank you Zaid. Thank you Abike.
SPEAKER_00
[SPEAKER_01] So we've been hearing a lot about what the data model looks like for how you store memories. [SPEAKER_01] We're talking about context graphs and it's all about decision making. [SPEAKER_01] Why do we really care about decision making? [SPEAKER_01] And maybe you noticed the awesome animation. [SPEAKER_01] How many people have a claw? [SPEAKER_01] Claw owners, some of you. [SPEAKER_01] Some of us have claws these days, right? [SPEAKER_01] At least you have heard about claws. [SPEAKER_01] What's awesome about open claw, all the different claws, is they really exaggerate the need for good decision making.
SPEAKER_00
[SPEAKER_01] Where decision making is basically when you run into a point in the workflow or the life of the agent where it has to do something that it doesn't have in its setup. [SPEAKER_01] You haven't given it instructions about what to do in a certain circumstance. [SPEAKER_01] Autonomous agents run into this all the time. [SPEAKER_01] If you just let them go and do stuff, give them a credit card, give them access to your Amazon account, and say, hey, keep my stock completely, my fridge stocked with Red Bull at all times. [SPEAKER_01] Okay, if they notice that you need some Red Bull, they're going to go order some Red Bull.
SPEAKER_00
[SPEAKER_01] They may not know, oh yeah, I should order Red Bull unless the rent is coming up and I don't have enough money for rent. [SPEAKER_01] You may not have anticipated that. [SPEAKER_01] You haven't given it instructions about what to do in a certain circumstance. [SPEAKER_01] Autonomous agents run into this all the time.
SPEAKER_00
[SPEAKER_01] If you just let them off and go and do stuff for free, give them a credit card, give them access to your Amazon account, and say, hey, keep my stock completely, my fridge stocked with Red Bull at all times. [SPEAKER_01] Okay, if they notice that you need some Red Bull, they're going to go order some Red Bull. [SPEAKER_01] They may not know, oh yeah, I should order Red Bull unless the rent is coming up and I don't have enough money for rent.
SPEAKER_00
[SPEAKER_01] You may not have anticipated that. [SPEAKER_01] You can go and fix that with some prompt engineering and keep improving the instructions for the agent. [SPEAKER_01] But really there's a meta problem, which is how do you make good decisions? [SPEAKER_01] I'm going to talk through, given if you have some memory, if you have a graph around, you've got an agent running, what does an agentic workflow look like for actually making good decisions? [SPEAKER_01] Because the crab wants help. [SPEAKER_01] Help the poor crab. [SPEAKER_01] Okay, and actually it's even worse, of course, if you've gone down this path at all.
SPEAKER_00
[SPEAKER_01] You start with maybe one agent that's running. [SPEAKER_01] That becomes multiple agents that have specialized tasks, they're all off doing things. [SPEAKER_01] They all have to collaborate together. [SPEAKER_01] They all have to be self-aware of each other and themselves.
SPEAKER_01
The problem gets worse and worse at scale.
SPEAKER_00
[SPEAKER_01] So you need a thoughtful framework for how to make decisions.
SPEAKER_01
If you have friends who are in MBAs that went through some business school, perhaps here in the Judge Business School in the UK, they probably have entire courses on how to make good decisions. I'm going to talk through a framework that you can give to an agent. You can implement yourself in your choice of framework, whether it's LangGraph or if you just want to write some skills, you can give that a try as well. But this overall workflow is just how you make decisions generally as a human.
SPEAKER_01
And as we know for much of the engineering we do these days, transferring our implicit understanding about how to do things in an explicit way to the agents is what helps agents do their job really well. So given a context graph, given some memory, here's a workflow for actually making good decisions. Okay. Starts at the top with just framing the problem. It's the local context that matters. And for the local context, there's how did you get here in the first place? That's the causality of the second one actually. I would probably lead with that.
SPEAKER_01
You went through some reasoning chain, you went through some actions, and suddenly you're at a point where you have some amount of uncertainty. And rather than just making a choice about what to do next, you're, hang on, let me go into this sub-process, which is decision making, and figure out what to do. You've got an objective in mind, something you want to get out of that process. And the example we had before for finance was actually instigated by somebody who wants to increase their loan or something like that. Fine. Could be that, could be ordering Red Bull, whatever the decision might be.
SPEAKER_01
An objective, the causality that led to having that objective be a thing you want to resolve. And then there's an environment within which that's actually operating, that's purchasing, that's actually perhaps medical decision making guidance in that realm. So it goes from, hey, can I order Red Bull to there's a life at stake? Those are very different environments, but those environments matter for what kinds of decisions you end up making. That's the kind of thing that we understand because we experience these things. You have to tell the agent these things so that they understand it as well.
SPEAKER_01
Once you've got the framing, that feeds into a larger context, which is the global context around what did you do before in this situation? That's always a good idea. If you can stay consistent, that's really good. But then also there are global rules, both the hard and soft rules of a business. Maybe they're formally described in a business process language or something like that. Or they're just informal in some kind of guidance in Slack channels and Google Docs, whatever. Hard and soft rules come to place here for having alignment over the decisions you're making. And it's important to keep both of those things in balance. What did you do before?
SPEAKER_01
Could be the right thing to do again. But also what are the global rules that are applying now that might have been different before? So there might be a reason to overrule what prior decisions were. These are all part of the framework. You've got the inputs. You've got a framework for the decision making that is global. And now you've actually got to go through and do the analysis. And this is of course just the classic risk value analysis. And you're going to figure out for the risk side, that's probably where an agent should spend most of their time. If it's a serious thing, then you spend even more time.
SPEAKER_01
And by serious, I would mean things like this first point is called a reference class validation, where a reference class is rather than assuming what is good and what matters, you have to try to decide for the players involved, what is the most important thing for them? And so what is your reference point for what's important to them? The example I love here is if you have, in medical care, this is a very dangerous area to be doing, letting open call loose, right? If you're prescribing drugs for somebody, and 99% of the time, you might prescribe drug X for symptom Y. And that's the right thing to do 99% of the time.
SPEAKER_01
But for the 1% of the time, if you're in the small 1% of the population, giving that same drug might be fatal. So before deciding what you should do, it's very important to know if you're part of the 99% or the 1%. Statistical behavior does not really help you there. That's an extreme example, but there's flavors of that in many decision-making circumstances that right now are kind of implicit for us. A lot of our practice as AI engineers is being explicit about the implicit knowledge that we carry with us. So keep that in mind. Actually classifying what matters, what doesn't matter, what is the actual risk involved. Is the decision reversible? Can you take it back?
SPEAKER_01
drug might be fatal. So before deciding what you should do, it's very important to know if you're part of the 99% or the 1%. Statistical behavior does not really help you there. That's an extreme example, but there are flavors of that in many decision-making circumstances that right now are implicit for us. A lot of our practice as AI engineers is being explicit about the implicit knowledge that we carry with us. So keep that in mind. Actually classifying what matters, what doesn't matter, what is the actual risk involved. Is the decision reversible? Can you take it back? Be able to say, oh sorry, that was obviously a bad idea. Let's just back it off and do it again.
SPEAKER_01
That changes the dynamics of how you assess things. And then also, what's the cost of being wrong generally? Again, is a life at stake? Or is it, okay, I'm going to not have Red Bull in my refrigerator? Not great, but not the end of the world, so it's okay if that's a bad decision. Then also, of course, on the value side, it isn't obvious what you're maximizing. Are you trying to maximize your savings, your budget? So actually, don't spend all your money on Red Bull. Save some aside because you're saving for a vacation or for buying a house or whatever it might be. What is it, are you maximizing some value or are you trying to minimize some cost?
SPEAKER_01
That has to be part of it as well and it has to be explicit. Without that, an agent is going to take its general knowledge of conditions and be like, okay, well, most of the time, this is the right thing to do. But the particulars matter. The particulars always are important. And then the final thing is that the output of this stage is actually not making a decision. I like to think in terms of multi-agent systems. For me, I love compartmentalized, highly focused agents working together. This agent's job, the only thing would be to actually come up with a proposal of some alternatives and to give some pros and cons for those alternatives, not to actually make the choice.
SPEAKER_01
The choice then would be handed off to the next agent, which would be actually deciding whether or not it can act. Does it have the authority? And if it does, it can go ahead and rank the options that it has available to it and take those actions and have the impact actually be felt. Or it can decide, actually, I don't have certainty here or I don't have authority here. So let me escalate this to either another agent or another actor that could be a human that does have the authority that can make the decision. So this is incredibly important here. Either act or don't act. Let somebody else make the call.
SPEAKER_01
And the oversight here is basically the sub-process that would be kicked off for a human in the loop to step in or an agent with higher privileges. The final part of this is really an important self-learning part. Once you're done, once the decision has been made, either a decision has been made or there was not enough information or certainty to make the decision, you might defer actually doing anything. That's a possible state as well. Or if you make the decision, record the entire reasoning process, what you considered, what you didn't consider. This is part of the tracing, the accountability that we talked about in all of the other moments around context graphs.
SPEAKER_01
That all gets saved into the graph along with the decision itself and the actions that were taken that lets future agents do better at their job because they have this now as precedent that they can refer to. Okay, that was my speed run. This is the full diagram of the workflow. You can implement this again if you want to in LangGraph, in ADK, whatever you've got on hand. Write up some skills doing this. That works well. I will say it's very hard to generalize. Each of these things, this is a general framework. The particulars of every step end up being very domain specific. So a bit of a caveat there.
SPEAKER_01
We're obviously working on lots of different examples in different domains for this stuff. So if you've got a domain that we haven't really talked about yet, I'd love to talk about it so we can add it to our catalog of things. [SPEAKER_00] Okay. Very quickly, that was me. Call to action is the same as Steve had before. If you want to learn more about this stuff, we have free online courses at Graph Academy. You can learn more about context graphs, learn more about graphs. Come talk to us at the booths. Come talk to us after this talk. We love to talk about this all day long. Thank you.
SPEAKER_01
Actually classifying what matters, what doesn't matter, what is the actual risk involved. Is the decision reversible? Can you take it back? Be like, oh sorry, that was obviously a bad idea. Let's just back it off and do it again. That changes the dynamics of how you assess things. And then also, what's the cost of being wrong generally? Again, like is the life at stake? Or is it the, okay, I'm going to not have Red Bull in my refrigerator? Not great, but not the end of the world, so it's okay if that's a bad decision. Then also of course, on the value side, it isn't obvious what you're maximizing. Are you trying to maximize your saving your budget?
SPEAKER_01
So actually, don't spend all your money on Red Bull. Save some side because you're saving for a vacation or for buying a house or whatever it might be. What is it, are you maximizing some value or are you trying to minimize some cost? That has to be part of it as well and it has to be explicit. Without that, an agent is going to take its general knowledge of conditions and be like, okay, well, most of the time, this is the right thing to do. But the particulars matter. The particulars always really are important. And then the final thing is that the output of this stage is actually not making a decision. I like to think in terms of multi-agent systems.
SPEAKER_01
For me, I love compartmentalized, highly focused agents working together. This agent's job, only thing would be to actually come up with a proposal of some alternatives and to give some pro cons for those alternatives, not to actually make the choice. The choice then would be handed off to the next agent, which would be actually deciding whether or not it can act. Does it have the authority? And if it does, it can go ahead and rank the options that it has available to it and take those actions and have the impact actually be felt. Or it can decide, actually, I don't have certainty here or I don't have authority here.
SPEAKER_01
So let me escalate this to either another agent or another actor that could be a human that does have the authority that can make the decision. So this is incredibly important here. Either act or don't act. Let somebody else make the call. And the oversight here is basically the sub-process that would be kicked off for a human in the loop basically to step in or an agent with higher privileges. The final part of this is really an important self-learning part. Once you're done, once the decision has been made, either a decision has been made or there was not enough information or certainty to make the decision, you might defer actually doing anything.
SPEAKER_01
That's a possible state as well. Or you make the decision if you had, record the entire reasoning process, what you considered, what you didn't consider. This is part of the tracing, the accountability that we talked about in all of the other moments around context graphs. That all gets saved into the graph along with the decision itself and the actions that were taken that lets future agents do better at their job because they have this now as precedent that they can refer to. Okay, that was my speed run. This is the full diagram of the workflow. You can implement this again if you want to in LangGraph, in ADK, whatever you've got on hand.
SPEAKER_01
Write up some skills doing this. That works well. I will say it's very hard to generalize. Each of these things, this is a general framework. The particulars of every step end up being very domain specific. So a bit of a caveat there. We're obviously working on lots of different examples in different domains for this stuff. So if you've got a domain that we haven't really talked about yet, I'd love to talk about it so we can add it to our kind of catalog of things.
SPEAKER_00
Okay.
SPEAKER_01
Very quickly, that was me. Call to action is the same as Steve had as well before. If you want to learn more about this stuff, we have free online courses at Graph Academy. You can learn more about context graphs, learn more about graphs. Come talk to us at the booths. Come talk to us after this talk. We love to talk about this all day long. Thank you. .