Chapter 20: Shared State
Lecture
Chapter principle
Key takeaways
- Shared state and model context are different abstractions.
- A blackboard lets agents coordinate indirectly through persistent task state.
- Structured state should preserve provenance and uncertainty.
- Last-write-wins is not a truth-resolution policy.
- Versioning detects stale computations; task claims need concurrency control.
- Write permissions and validation make shared state a security boundary.
Experiments
Every experiment in the book is small, runnable and printed with its real output. In the Lab you can replay a recorded real run of each one, with no programming, and watch what the model and the agent do.
Experiment 36: Blackboard
How can agents share facts without overwriting each other?
Agents work out an order total: unit price × quantity + shipping. They share a blackboard that stores each fact with its source, a version number, and who has claimed which task. Each worker is a real model that reads one source and extracts one number. Then a cached web page claims a different price, two agents try to take the same task, and a price correction arrives while the total is being computed. This is a recorded run.
All the code for this chapter: github.com/agentic-engineering-book/code
Download the bookBrowse all chapters