← Table of Contents · Page 465 of 868
COORDINATION MECHANICS
Part 6 of 11
SHARED STATE THAT SURVIVES ACROSS HANDOFFS
Even with clean handoffs, some information needs to live longer than any single agent.
Shared state is information stored outside any one agent, in a place several agents can read, and sometimes write, so that it persists as work moves between them.
You met the idea of state in Chapter 10.
In a multi-agent system, shared state might include the overall task goal, the plan, progress so far, results already gathered, decisions already made, and the budget already spent.
Think of a hospital patient chart.
Doctors and nurses change shifts all day, but the chart stays with the patient and carries the history forward, so no one has to start from scratch.
Shared state serves a similar role.
It might live in a database, a file, or a key-value store, which is a simple storage system that maps names to values.
There are three design rules worth remembering.
First, decide who owns each piece of state.
If two agents write to the same field at the same time, one may overwrite the other, a problem called a write conflict.
A simple solution is to give each field exactly one writer, while allowing many readers.
Second, keep an audit trail.
Record who changed what and when, so that if something goes wrong, you can trace it, connecting to the observability ideas in Part Seven.
Third, keep shared state lean.
It is tempting to dump everything in it, but a huge shared state recreates the clutter problem, because every agent loads too much.
Store large material, such as full documents, separately, and keep only references to it in the shared state.
Shared state and handoff objects work together.
The handoff object says, "Here is what you need right now," while shared state says, "Here is the durable record of where the whole job stands."
Advertisement
Read Aloud:
0:00 / 0:00