The durable object
AgentState has only two top-level fields: the nodes and the frontier.
Node anatomy
The ten kinds
There are exactly ten. All but a few are created by the runtime.The frontier
The frontier is the set of active graph heads. Adding a normal node removes its parents from the frontier and adds the new node. Verification nodes are causal evidence heads; semantic nodes use keyed resource chains without replacing the answer/tool frontier. A new goal uses the previous frontier as context, so continuity carries across turns. The frontier is not “the last message.” Work can branch into several active heads.Resource versions
A node with aresourceKey becomes one version in a chain. The next node with the same key links to the previous head.
Semantic memory
Asemantic node carries a payload with three fields:
memory: a durable fact or context;preference: a stable user choice or style;wisdom: a reusable, evidence-supported lesson;artifact: a durable output or renderable artifact.
semantic:<type>:<key>. Writing the same key again supersedes the old value. The model records semantic nodes inside a normal TOOL_CALL or FINAL, so memory capture needs no second call.
Set allowDynamicNodeTypes: true only when the agent may invent bounded lowercase types. Configured vocabularies are easier to retrieve and govern.
Safeguards on import
The constructor andreset() check:
- snapshot version;
- allowed kinds;
- unique IDs;
- parent existence and causal order;
- recomputed identities;
- contiguous sequence values;
- frontier references.