You will turn an AI agent's rules and past runs into a graph of nodes and relationships, so the agent follows defined paths instead of free text. It suits developers who already run an LLM agent and want predictable, auditable behaviour. Basic Cypher and a Neo4j database are the main requirements.
YouTube video: Make Your AI Agents Predictable With Graph Engineering - Zachary Blumenfeld, Neo4j
YouTube’s video details do not confirm captions. Check CC in the player for available tracks.
Choose a chapter (12)
- Video length
- 20 min 36 s
- Time to do it
- 3 hours
- Difficulty
- Medium
- Steps
- 8
What you need
Steps
List the decisions your agent has to make and the rules that connect them. Draw each decision as a node and each allowed next step as a directed edge.
Choose the graph type for the job: a context graph for memory, a skill graph for procedure, or a knowledge graph for facts. Keep the three separate.
Load the graph into Neo4j. Give nodes clear labels such as Decision or Skill, and name relationships NEXT, REQUIRES or PRODUCES.
Store agent memory as a context graph. Attach each past run to the user, the inputs it received and the outcome it produced.
Write each skill as a small subgraph: ordered steps, the condition for every branch, and a clear exit condition. Compile it once and reuse it.
Distill new skills from the memory graph. Find runs that succeeded repeatedly and turn their shared path into a reusable skill graph.
At runtime, query the graph for the current state, let the agent move only along permitted edges, and log the path it took.
Review the logged branches, compare passing and failing runs, and delete edges that lead to bad outcomes.
Tips and common mistakes
Keep node and relationship names stable so your queries and dashboards do not break when prompts change.
Replay a batch of past runs against the new graph before putting it in front of real users.
Store free text as properties, not as extra nodes, so the shape of the graph stays readable.
Questions
Do I need Neo4j specifically?
No. Any graph database works, and a relational database with join tables can hold the same nodes and edges. Neo4j is just convenient for traversal queries.
What is the difference between a context graph and a skill graph?
A context graph records what happened, so it acts as agent memory. A skill graph records what should happen, so it acts as the procedure the agent follows.
Why does this make an agent more predictable?
The agent can only move along edges you defined, so its behaviour stays bounded. You can inspect and audit every path it takes.
The notes are drafted automatically from video details and general task knowledge. How the guide was prepared
Report a correction


