Contents Start here
Start here
Introduction: what this context engineering with Neo4j course builds, and how to use it
One question a fictional robot maker cannot answer today, and the knowledge graph, retrieval and agent memory you build in this course to answer it.
Free lesson
About 19 minutes to read.
Your progress0 of 9 checks answered right
It fills only when a prediction matches the measured result. Reading a page does not move it. It is kept in this browser.
Hands-On Context Engineering with Neo4j: Knowledge Graphs, GraphRAG and Agent Memory. Start here.
This course teaches one skill: choosing what a language model sees when it answers. That skill has a name, context engineering, and it decides more about the quality of an AI feature than the choice of model does. You will learn it with one very good tool for the job, a knowledge graph in the graph database Neo4j. You will follow one fictional company, Ferncliff Robotics, from the first question its staff cannot answer to an assistant that answers its questions from a graph, remembers what changed, and has been measured against plain search on the same questions. This lesson tells that story in plain words, shows the first real measurement you will start from, explains how the course is laid out, and says what you need before you begin.
After this lesson you will be able to:
- say in plain words what context engineering is, and why a model cannot answer questions about your company without it;
- explain why Ferncliff Robotics is fictional, and how its data is made;
- read the first measured run of the course: one question, asked four ways, with the tokens, the cost and the score of each;
- name the eight parts of the course and what each one leaves you with;
- use a lesson of this course well: the predict-then-measure checks, the labs, and what each lab costs.
What you need first: nothing. This is a reading lesson with checks along the way. There is no code to run in it.
Time: about 25 minutes.
What it costs: nothing. This lesson starts no cloud resources and makes no model calls.
Dates and times: every time in this lesson is in UTC. The measurements come from the lab run of the lesson "What context engineering is", on 6 December 2026, started at 07:38:51 UTC, on an AWS EC2 t2.small machine in us-east-1.
The problem: a model knows the world, but not your company
Picture an operations lead at a company that builds warehouse robots. A supplier has just told her that one batch of drive motors has a winding fault, and her engineers have recalled the part in an incident report. Her question is simple to say: which of our customers run a robot with that motor, and who manages each of those accounts? She needs the list before lunch, because every account manager has to phone their customer today.
She opens an AI assistant and types the question. The model is fluent and polite, and it cannot help her. It was trained on a great deal of public text, but her company's customers, robots, parts and incident reports were never in that text. They live in her company's own documents and databases. A language model answers from only two things: what it learned in training, and what is in front of it when you call it. For a question about her company, the second one is everything.
What is in front of the model when you call it is called its context: the instructions, the conversation so far, any tool results, and the facts you choose to paste in. The model reads the context as tokens, small pieces of text that are often parts of words, and you pay for every one of them. Choosing those tokens well is context engineering. Anthropic's engineering team describes it as the strategies "for curating and maintaining the optimal set of tokens" while a model works. That is the whole subject of this course.

Read the figure from left to right. The four shapes on the left are everything your program can put into one call, and the single numbered arrow is the call itself. Only the bottom shape, the facts, can carry anything private about Ferncliff, which is why the rest of this course is about choosing those facts well.
The company in this course: Ferncliff Robotics, a fictional robot maker
The company in every lesson of this course is Ferncliff Robotics. You should know this clearly from the start: Ferncliff Robotics is fictional. It does not exist, and any likeness to a real company is an accident. Here is what the course invents for it:
- It builds three models of warehouse robot: the FR-200 Picker, the FR-400 Mover and the FR-900 Heavy Lifter.
- It has 12 customers, warehouses in cities around the world, and 49 robots in the field.
- Each robot model is built from parts bought from six fictional suppliers.
- It keeps the kinds of documents every real company keeps: a product manual for each model, an account note for each customer, and 60 incident reports written by its engineers.
Every record is synthetic: made by the course's own generator program from a fixed starting number, so that everyone who builds the lab gets exactly the same data, and every answer in the course can be computed and checked. No real person's data is used anywhere. The generator writes the same facts twice: once as a graph of nodes and relationships, and once as the 75 plain text documents a company really has. That is what lets the course ask the same question of the documents and of the graph, and compare the two fairly.
Why it matters: the obvious fix does not work as well as it looks
The obvious fix for a model that does not know your facts is to paste all of your documents into the context. Models now accept long inputs, so it seems you could simply give the model everything and let it find the answer.
We tried that on 6 December 2026. Here is the first lab of the course, run on a small cloud machine with a cheap, current model, gpt-5.4-mini. We asked the operations lead's question in four ways, three times each, and scored every answer by code against the true list, which the generator computed from the facts. The true answer is 7 customers.
| What the model was given | Input tokens | Customers named correctly | Cost per answer |
|---|---|---|---|
| Only the question | 107 | 0 of 7 | $0.00026 to $0.00028 |
| All 75 documents, pasted in whole | 9,013 | 7, 4 and 4 of 7, with 4, 0 and 1 wrong | $0.00720 to $0.00773 |
| The 5 chunks most similar to the question | 384 | 0 of 7 | $0.00052 to $0.00054 |
| The rows of one query on the knowledge graph | 390 | 7 of 7 | $0.00079 to $0.00091 |
Three of the four rows gave the same score in all three runs. The row with every document did not, so it shows all three. Read the table slowly, because the whole course grows out of these four lines.
- Only the question. The model named nobody, and said so. That is the right behaviour: it cannot know a company's private facts.
- Every document. The three runs gave three different answers: all 7 customers plus 4 who were not affected, then 4 of the 7, then 4 of the 7 plus one wrong customer. Each answer cost about eight to nine times as much as the answer built from the graph. The facts were all there, but they were spread across a manual, an incident report and twelve account notes, and the model had to join them in its head across 9,013 tokens.
- The 5 most similar chunks. This is plain vector search, the usual first step of retrieval: cut the documents into pieces, turn each piece into a list of numbers called an embedding, and pick the pieces whose numbers are closest to the question's. It found the recall's incident report and four other incident reports, and nothing else. The customers are named in account notes, which do not look like the question at all, so similarity never reached them.
- One graph query. A query in Cypher, Neo4j's query language, followed the connections: from the incident to the recalled part, from the part to the robot model that contains it, from the model to the robots in the field, from the robots to the customers that run them, and from each customer to its account manager. It returned 7 rows, which became 8 short sentences and 390 tokens of context. The model named all 7 customers with the right managers, in every run.

Read the two charts as one table turned on its side. Each column is one way of building the context, the top chart says how much the model had to read, and the bottom chart says how many of the 7 customers it got right. Compare the last two columns: almost the same number of tokens, and a score of 0 against a score of 7. What mattered was which facts went in, not how many.
One question is not proof of anything general, and the course never pretends it is. Part 6 measures a full question set of every kind, including the kinds where plain vector search is the better and simpler choice. But this one question shows the idea clearly: the model did best not when it saw the most text, but when it saw exactly the facts the question needed, already joined.
The idea: a graph keeps the connections that a question follows
A graph database stores facts as nodes, the things (a customer, a robot, a part), and relationships, the connections between things (this customer RUNS this robot, this robot model CONTAINS this part). Both can carry properties, such as a robot's serial number. Neo4j is a widely used graph database, and Cypher is the language you query it with. A Cypher query is written as a picture of the pattern you want to find, and the database follows the relationships to find every match.
A knowledge graph is a graph of the facts a company knows, built so that questions can follow it. When you use one to choose what goes into a model's context, the technique is often called GraphRAG. RAG stands for retrieval-augmented generation: fetch relevant facts first, then let the model write the answer from them. In practice GraphRAG usually means vector search and graph traversal together. Similar text finds the starting point, and the graph follows the connections from there.
The same graph can also hold an agent's memory: what it learned from each conversation, about whom, and when each fact became true or stopped being true. Part 5 builds that with Graphiti, an open-source temporal knowledge graph library made by the company Zep, on your own Neo4j.
The story of the course, in order
Part 1, foundations. What a model really sees when you call it, and why the facts you hand it decide the answer. Then graphs from zero: nodes, relationships and properties, your first Cypher queries, MERGE so that a rerun never creates duplicates, paths several hops deep, counting and collecting, the Ferncliff knowledge graph loaded with the Python driver, vector indexes inside Neo4j, and graph retrieval measured against vector retrieval on real questions.
Part 2, a knowledge graph from documents. Real companies do not hand you a clean graph. You design the graph from the questions people ask, store documents and chunks so that every fact points back to its source, extract entities and relationships with a model, run the neo4j-graphrag pipeline, merge names that mean the same thing, and measure how good the extraction is.
Part 3, GraphRAG. A plain vector baseline on Ferncliff's questions, vector search followed by a graph traversal, hybrid search for exact names and part numbers, questions turned into Cypher safely through a read-only user, questions about the whole dataset, choosing a retriever, and packing the result into the context with a citation for every fact.
Part 4, Neo4j's own tools. What Neo4j itself ships for this work: the neo4j-graphrag package, the langchain-neo4j integration, the Neo4j MCP servers that let an agent query a graph, the LLM Knowledge Graph Builder, and Aura, the managed service.
Part 5, agent memory on a graph. What agent memory is, memory stored as a graph, writing memories from a conversation, facts that change over time, Graphiti from zero, searching memory, deleting what must be forgotten, and an agent that remembers each customer between conversations.
Part 6, proving it works. A question set with answers computed from the data, scored by code first and by a checked model judge second, answered with and without the graph, with the tokens, the time and the dollars of every answer, and a lesson on the questions where the graph loses.
Part 7, production. Memory and sizing, loading large data fast, Aura against running Neo4j yourself, security when agents query a graph, keeping many customers apart in one graph, backups and upgrades, and the full cost of one answer.
Part 8, the capstone. A knowledge graph assistant for documents you choose, built and measured against plain vector search, and written up for your portfolio.

Read the map down the left column and then down the right, in the same order as the parts above. The bold line in each box is the part's name, and the sentence under it is what you can do, or what you have built, when you finish that part.
How a lesson of this course works
Every lesson follows the same order: a real question at Ferncliff, why it matters, the idea with a drawing, a hands-on run with real output, and a short check of what you understood. No lesson opens on code.
Predict, then measure. Before a lesson shows the result of its lab, it asks you to predict it. You choose an answer and lock it in, and only then does the lesson show what the real run measured, whether you were right, and why. Your progress in the course counts only predictions you got right on the first try. It never counts visits, clicks or time spent. This is how you find out which of your instincts about models and graphs are wrong, which is most of the value.
Where each lab runs. The contents of the book say, for every lesson, whether its hands-on is reading only, uses your Neo4j database, calls a model API, or both. No lab needs a GPU, because Neo4j runs on an ordinary CPU and the models run behind an API.
What each lab costs. Every lab lesson states the cost of its own run. The lab machine, an AWS EC2 t2.small, costs $0.023 an hour, and a whole lab session costs a few cents of AWS. One answer built from the graph cost between $0.00079 and $0.00091 in model tokens.
What you need before you begin
- Python: you can read and change a 200-line program.
- The terminal: you can run commands and set an environment variable.
- A model API key you can put a small monthly limit on. The course uses OpenAI's API in its runs; the lesson "Before you start" shows how to set it up with a spending limit.
- A Neo4j database. The next lesson, "Before you start", shows two ways to get one: Neo4j AuraDB Free, which costs nothing, or Neo4j Community Edition in Docker on a small cloud machine of your own.
You do not need any graph database experience, any machine learning background or a GPU. Each idea is explained the first time you need it.
Questions people ask
- What does a context engineering course teach?
This one teaches you to choose what a language model sees when it answers, and to build that context with a knowledge graph in Neo4j. You learn Neo4j and Cypher from zero, build a graph from a fictional company's documents, answer questions with vector search and the graph together, give an agent a memory that knows when facts changed, and measure every answer with and without the graph.
- Is Ferncliff Robotics a real company?
No. Ferncliff Robotics is fictional, and every customer, person, robot, part and document in its data is synthetic, made by the course's own generator from a fixed starting number. That is what lets every answer in the course be computed from the data and scored by code.
- Do I need a GPU for this course?
No. Neo4j runs on an ordinary CPU, and the models run behind an API. Our first lab ran on an AWS EC2 t2.small with one virtual CPU and 2 GB of memory, at $0.023 an hour.
Knowledge check
Tap an answer to see straight away whether it is right, and why. You can try the whole check again at the end.
- Question 1
Why can a language model not tell Ferncliff's operations lead which customers run the recalled motor, when it is given only the question?
- Question 2
In the first lab, all 75 documents were pasted into the context. What happened?
- Question 3
Why did the 5 chunks most similar to the question lead to 0 of 7?
- Question 4
What does your progress in this course count?
- Question 5
What does GraphRAG usually mean in practice?
0 of 5 right so far, 0 of 5 answered.
Words from this lesson
| Word | What it means |
|---|---|
| context | everything a language model sees when you call it: instructions, history, tool results and the facts you give it |
| token | a small piece of text, often part of a word; models read, and are billed, in tokens |
| context engineering | choosing what goes into a model's context, in what form, and how many tokens it may cost |
| synthetic data | records made by a program, not taken from real people |
| embedding | a list of numbers that stands for a piece of text, so that similar texts get similar numbers |
| vector search | finding the pieces of text whose embeddings are closest to the question's |
| graph database | a database that stores things as nodes and the connections between them as relationships |
| Neo4j, Cypher | the graph database this course uses; the language you query it with |
| knowledge graph | a graph of the facts a company knows, built so that questions can follow it |
| RAG, GraphRAG | fetching relevant facts before the model answers; doing that with a knowledge graph, usually together with vector search |
| agent memory | what an AI agent keeps between steps and conversations, and how it finds it again |
What to keep
A language model answers from its training and from its context, and for questions about your own company only the context helps. Context engineering is choosing that context well. In the first lab of this course, the same model answered the same question with 0, between 4 and 7, 0, and 7 of 7 customers right, depending only on what it was given, and the only answer that was right every time came from 390 tokens of facts that one graph query had already joined, not from 9,013 tokens of every document. This course teaches you to build that kind of context with Neo4j, and to measure when it helps and when it does not.
The next lesson, "Before you start", gets you a Neo4j database and checks that it answers.
Sources
- Our own lab run of 6 December 2026, on an AWS EC2 t2.small (1 vCPU, 2 GB of memory) in us-east-1 with Ubuntu 24.04.5 LTS, Docker 29.1.3, Neo4j 2026.10.2 Community Edition in Docker and the neo4j Python driver 6.4.1, started at 07:38:51 UTC: the run files
2026-12-06-context-gpt-5.4-mini.jsonand2026-12-06-load.txtin the course's lab folder. The model reported itself as gpt-5.4-mini-2026-03-17. - OpenAI's API pricing page, standard tier, read on 14 November 2026 and again on 6 December 2026 at https://developers.openai.com/api/docs/pricing: gpt-5.4-mini at $0.75 per million input tokens and $4.50 per million output tokens.
- The AWS Price List API for us-east-1, read on 14 November 2026 and again on 6 December 2026: t2.small $0.023 an hour.
- Anthropic, "Effective context engineering for AI agents", 29 September 2025, https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents, for "for curating and maintaining the optimal set of tokens".
- Graphiti, the open-source temporal knowledge graph library made by Zep: https://github.com/getzep/graphiti (graphiti-core 0.32.1 on PyPI, read on 6 December 2026).
- The parts and lessons of the course: the course contents of 6 December 2026.