The durable object

AgentState has only two top-level fields: the nodes and the frontier.
It is JSON, provider-neutral, and owned by your application. A vocabulary of ten distinct node categories in one causal graph

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 a resourceKey becomes one version in a chain. The next node with the same key links to the previous head.
The graph keeps both. Projection shows the newest.

Semantic memory

A semantic node carries a payload with three fields:
Built-in types:
  • 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.
You can replace this vocabulary per product:
A semantic resource key has the form 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 and reset() check:
  • snapshot version;
  • allowed kinds;
  • unique IDs;
  • parent existence and causal order;
  • recomputed identities;
  • contiguous sequence values;
  • frontier references.
Treat invalid imported state as untrusted input. Do not repair it silently. Next: One turn.