Skip to content

Control flow and durable effects

A workflow graph is derived from TypeScript call sites and concrete run effects. It is useful for review, but it is never a second editable execution format.

Use normal language constructs:

const snapshot = await ctx.evm.snapshot({
key: "balance",
chainId: 1,
reads: [{ kind: "native-balance", address: input.account }],
maxResultBytes: 8_192,
})
if (snapshot.values[0] < input.minimum) {
const choice = await ctx.human.choice({
key: "low-balance-choice",
title: "Balance is below the requested minimum",
audience: "workflow_owner",
options: [
{ id: "continue", label: "Continue" },
{ id: "stop", label: "Stop" },
],
maxResultBytes: 4_096,
})
if (choice.optionId === "stop") return { status: "stopped" }
}

The revision graph marks dynamic or incomplete paths. The run graph shows only concrete effect occurrences, causal frontiers, loop iterations, waits, observations, attempts, and human actions.

  • evm.snapshot: read contract, balance, or block state at one pinned block.
  • http.snapshot: make one bounded GET or HEAD request and freeze the result.
  • evm.waitForEvent: wait for the first confirmed matching ABI event.
  • timer.wait: wait until a duration or timestamp.
  • human.confirm, human.choice, human.form: wait for an eligible person.
  • notification.send: enqueue a sanitized authored notification.
  • evm.transactions: freeze a reviewable EOA sequence or atomic Safe batch.

Every effect requires a deterministic stable key and a positive maxResultBytes. Duplicate keys or a repeated key with different request bytes fail closed.

The request freezes its title, description, audience, options or form schema. Eligible members answer in the run UI. Organisation admins may perform a clearly labelled, audited override. Agents cannot resolve human effects.

A durable program may wait across process restarts and long periods without holding a server or VM stack. Caught effect failures behave like caught JavaScript errors. Promise.allSettled is useful when the program can continue after one branch fails.