TypeScript SDK · Causal Weave v3

A graph is the memory.

StateWeave is a low-level agent primitive. It stores what happened as an immutable causal graph, then compiles only the relevant part into each model prompt.
StoreAppend causal nodes
SelectCompile a bounded view
ActCall a normal model
CommitRecord evidence and answer
Most agent runtimes make a conversation transcript the durable object. StateWeave does not. Its durable object is AgentState: goals, inferences, tool evidence, resource versions, semantic memory, errors, and answers connected by direct dependencies. A provider still receives a linear token sequence. Transformers require one. StateWeave treats that sequence as a temporary view of state, not as state itself.
Core invariant

A model action’s parents are exactly the graph nodes selected for that inference.

The runtime knows the read set because it builds the prompt. The model does not draw edges or emit graph operations. It returns an ordinary TOOL_CALL or FINAL; StateWeave records the lineage.

Why this primitive exists

Long-running agents need two things that transcripts conflate:
  1. A complete record. What was observed, changed, superseded, rejected, and concluded?
  2. A small working view. What does this inference need now?
Deleting old messages damages the record. Replaying every message eventually exceeds the model window. Summaries help with size, but they replace evidence with another generated statement. StateWeave separates the two concerns. The graph remains append-only. Projection is allowed to omit, rank, collapse, and supersede details only in the next prompt.
The graph is truth. The prompt is a view.

What StateWeave owns

StateWeave owns

Causal nodes, projection, action parsing, tool evidence, state validation, and run traces.

You own

The model adapter, tools, persistence, product policy, user interface, and deployment.

The provider sees

The bounded compiled prompt and provider-level system instruction for the current inference.

StateWeave is not a model, database, vector store, workflow service, or hosted memory product. It is the state machine beneath an agent.

Read this manual

The shortest path is:
  1. Run the quickstart.
  2. Read Why StateWeave.
  3. Follow one turn through How it works.
  4. Use the complete example as an integration template.
The public SDK has one agent class: Agent.