Durable state

State is small permanent JSON memory shared by future runs of the same workflow ID and state location.

JavaScript
const current = await services.state.get("order-count");
const result = await services.state.increment(
  "order-count",
  1,
  { name: "increment-order-count" }
);
MethodSignature and behavior
get<T>(key){ found: true, value, version, updatedAt } or { found: false }.
has(key){ present, version? }.
set(key, value, { name, ifVersion? })Durable versioned write.
delete(key, { name, ifVersion? })Durable conditional delete.
increment(key, amount, { name, ifVersion? })Atomic durable counter.
setIfAbsent(key, value, { name })Atomic one-winner durable initialization.

Every mutation requires a stable name. Retry with the same identity reattaches to the original committed result. Use ifVersion for compare-and-set. State does not expire, evict, enter context, or appear in normal run inspection. It is not transparently encrypted; protect the state file and backups and do not store secrets in state. Limits are 256 UTF-8 bytes per key, 256 KiB canonical JSON per value, 10,000 live keys, and 64 MiB of canonical values per workflow scope.