Skip to content

KV Store Write

Overview

The KV Store Write node persists a value under a named key in the workflow's scoped key-value store, making it available to downstream nodes via KV Store Read. Keys are scoped to the workflow run by default, so concurrent runs do not collide. Use this node to cache intermediate results, pass state across branches, or accumulate data across loop iterations. If the key already exists its value is overwritten without error.

Configuration

FieldTypeRequiredDescription
keystringYesThe key under which the value is stored. Supports template expressions (e.g. battle_{{run.id}}_score) for dynamic key names.
valuestringYesThe value to write. Accepts a literal string, a JSON expression, or a reference to an upstream node output (e.g. {{nodes.scorer.output.score}}).
scopeenumNoStorage scope: run (default, isolated per workflow run), workflow (shared across all runs of this workflow), or global (shared across all workflows in the project).
ttlnumberNoTime-to-live in seconds. If set, the key expires automatically after this duration. Omit for indefinite storage within the scope lifetime.
overwritebooleanNoWhen false, the write is skipped silently if the key already exists. Defaults to true (always overwrite).

Inputs

PortTypeDescription
inputanyTrigger signal from the upstream node. The node executes when this port receives data.
valueanyOptional explicit value to write. When connected, overrides the static value config field. Accepts strings, numbers, objects, or arrays — objects are serialised to JSON automatically.

Outputs

PortTypeDescription
outputanyPasses the written value downstream unchanged, allowing the result to be consumed immediately without a separate KV Store Read.
errorobjectEmits an error object { code, message } if the write fails (e.g. scope quota exceeded, invalid key format, or a TTL below the minimum). Connect to an error-handling branch to recover gracefully.

Example

json
{
  "nodeType": "kv_store_write",
  "config": {
    "key": "battle_{{run.id}}_winner",
    "value": "{{nodes.judge.output.winner_handle}}",
    "scope": "run",
    "ttl": 3600,
    "overwrite": true
  }
}