The product boundary is yours

StateWeave keeps state in memory while an Agent instance lives. Durable storage, authorization, and reconnect belong to your application.

Save after success

A stateful Agent serializes calls inside one process, not across replicas. For multi-replica safety, use optimistic concurrency or one session worker.

Watch engine progress

streamEvents() reports causal progress and forwards provider tokens/metadata while each model action is being collected.
Phases: context, model, tool, retrying, final. Progress events may include the exact prompt, graph view, raw output, action, tool, or error. Model events are separate so a consumer can render provider tokens without mistaking partial protocol text for a final answer. For just the answer:

Inspect without exposing everything

getGraph() maps causal nodes into consumer-safe nodes and edges. Large text is truncated; AgentState is unchanged.
Traces are more sensitive than the graph view. Each step can contain the exact prompt and raw output. Restrict access and retention.

Handle aborted and failed runs

Closing a streamEvents consumer aborts its run. A failed run’s graph explains what happened, but it is not the canonical session unless you model failures deliberately.

Traces only when needed

traceDir writes successful run results as JSON. In hosted products, prefer an access-controlled event store with explicit retention. Next: Complete agent.