blokboard/ Open beta

Build workflows

Remember values with State

Persist workflow memory between runs on the same runtime.

State stores named values for a workflow on the runtime executing it. Item paths can read the same saved key, and the value remains available for later runs.

Read Variables or State? for three concrete workflows: independent wallet reports, balance changes between runs, and the dust cleaner's shared batch.

Initialize, update, and remove

  • Initialize State creates a missing key using Initial value. If the key already exists, it keeps and returns the saved value. Changing Initial value does not reset it.
  • Update State replaces an existing key's value. A missing key is an error: initialize it first.
  • Delete State removes a key and reports whether it existed.

Read a saved value directly with {{state.lastBalance}}. There is no separate read node. Each node that uses State receives its current saved values before resolving parameters; an earlier node's output remains a snapshot. A deleted or never-created key reads as undefined. A saved null is an existing value and is preserved by initialization.

Keys can use expressions. For a key containing punctuation or chosen dynamically, use {{index(state, "sol:ADDRESS")}} or {{index(state, code.output.key)}}. Inside Code, the same snapshot is available as variables.state.

A scheduled balance report

Initialize lastBalance with null before the report. On Monday, no saved balance exists. After fetching 2 SOL and recording the report row, Update State saves that balance. On Tuesday, initialization keeps Monday's 2 SOL. The report compares it with Tuesday's 1.8 SOL, then updates it to 1.8. Defining a Variable as null at Start would start empty every day.

Practice this with editable balances.

A shared batch

Initialize batch as an empty List. Update it with {{append(state.batch, iterate.output.item)}} inside Sequential Iterate. Each item sees the previous saved list, and the done path can read the completed batch. When every run needs a fresh batch, explicitly clear it before the loop: initialization alone preserves the previous run's value.

State belongs to a workflow and runtime

Another workflow has separate State, even if it uses the same key. Browser, Desktop, and Extension storage are also separate. Moving execution to a different runtime does not copy the memory from the previous one.

An imported workflow is a new workflow and starts with no saved State from the author. A downloaded workflow file contains the definition, not execution memory.

Place checkpoints after successful work

For a cursor, read it near the start, process the next item, and save the updated cursor after the work succeeds. A checkpoint saved too early can cause later runs to skip work that never completed.

Separate reads and writes are separate operations. Reading state.key and then using Update State is not an atomic increment. Initialization checks and creates the key atomically, but it does not lock later work. Avoid using it as a shared counter across concurrent branches or overlapping runs.

State is application data, not a credentials vault. Keep secrets in connections and wallet storage.

Keep updates on the intended execution path so later steps read the value you expect.