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. Use it for a last processed identifier, a cursor, or a checkpoint that the next run should read.
Read, write, and remove#
- Get State reads a key and emits
key,found, andvalue. A missing key producesfound: falseandvalue: null. - Set State stores a JSON-compatible value and emits the saved key and value.
- Delete State removes a key and reports whether it existed.
Keys can use expressions. Use a complete value expression when storing an object, array, or number so its type is preserved.
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. A Get State followed by Set State is not an atomic increment. 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.
Run remember a value to see a missing key become a saved value.