Read State
Retrieves a persistent value from the workflow state store.
Reads a value by key. The global and case scopes read the workflow key-value state (kv_state); the instance scope always returns miss in the current runtime.
This operator is used to access data saved in previous steps or even from other workflows (using Global/Case scope). It provides a way to maintain context across long-running or distributed executions.
Behavior:
- Attempts to find the key in the specified scope.
- If found, returns the value.
- If not found, triggers the 'miss' port to allow for fallback logic.
Use Cases:
- Retrieving a cached user profile.
- Validating if a previous step completed via a state flag.
How it works
- Merges the input item with the resolved config (config wins).
- Uses
scope(defaultinstance) and leaves througherrorwithMissing 'key'whenkeyis empty. global: looks up<key>in$input.$kv_state.case: looks upcase:<key>in the same store.instance: reads the worker contextstate, which the runtime does not provide, so the value is always undefined.- An undefined value leaves through
misswith{ key }; anything else throughsuccesswith{ value }.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-read-last-sync",
"label": "Read last sync time",
"operator_slug": "ops.state.read",
"operator_version": "1.0.0",
"config": {
"scope": "global",
"key": "last_sync_at"
}
}{
"ok": true,
"port": "success",
"data": {
"value": "2026-11-25T23:00:00.000Z"
}
}Configuration
-
scopestring Required -
Visibility level to read from (Instance, Case, or Global system-wide).
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
key - Not in the config schema (only in the input contract), but read from the node config or, when unset there, from the input item:
key. -
scope caseis not isolated per case: it only prefixes the key withcase:in the same per-workflow store asglobal.globalis per workflow, not system-wide.
Output ports
success default The key exists in kv_state (global or case scope).
{
"value": "2026-11-25T23:00:00.000Z"
}miss The key is not in kv_state, the run received no kv_state, or the scope is instance.
{
"key": "last_sync_at"
}error key is empty. The output is the whole returned object, { port, error }.
{
"port": "error",
"error": "Missing 'key'"
}In expressions
What a later node can read from this node's output with $("Read State").item.json.<path> (write your node's label instead of Read State). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through success, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Read State").item.json.valueThe stored data. |
Errors
| Message | Port | Cause and fix |
|---|---|---|
Missing 'key' | error | key is set neither on the node nor in the input item. |
Input contract
-
keystring Required -
The unique key of the state variable.
Output contract
-
valueany Optional -
The stored data.
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "ops.state.read",
"name": "Read State",
"category": "ops",
"version": "1.0.0",
"description": "Retrieves a persistent value from the workflow state store.\n\n This operator is used to access data saved in previous steps or even from other workflows (using Global/Case scope). It provides a way to maintain context across long-running or distributed executions.\n\n **Behavior:**\n - Attempts to find the key in the specified scope.\n - If found, returns the value.\n - If not found, triggers the 'miss' port to allow for fallback logic.\n\n **Use Cases:**\n - Retrieving a cached user profile.\n - Validating if a previous step completed via a state flag.",
"capabilities": [
"state",
"persistence",
"read",
"store"
],
"config_schema": {
"type": "object",
"required": [
"scope"
],
"properties": {
"scope": {
"type": "string",
"enum": [
"instance",
"case",
"global"
],
"default": "instance",
"title": "State Scope",
"description": "Visibility level to read from (Instance, Case, or Global system-wide)."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
},
"input_contract_schema": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The unique key of the state variable."
}
},
"required": [
"key"
]
},
"output_contract_schema": {
"type": "object",
"description": "The retrieved value.",
"properties": {
"value": {
"type": "any",
"description": "The stored data."
}
}
},
"ports": [
{
"port_id": "success",
"label": "Found",
"is_default": true,
"description": "Value retrieved successfully."
},
{
"port_id": "miss",
"label": "Not Found",
"description": "Keys does not exist or has expired."
},
{
"port_id": "error",
"label": "Error",
"description": "Storage connectivity error."
}
],
"execution_mode": "sync",
"tags": [
"state",
"database",
"persistence",
"read"
],
"is_stateful": true,
"publisher": {
"identity": "org_link_loom",
"profile": {
"name": "Link Loom",
"verified": true,
"url": "https://me.veripass.com/link-loom",
"logo_url": null
}
}
}{
"type": "object",
"required": [
"scope"
],
"properties": {
"scope": {
"type": "string",
"enum": [
"instance",
"case",
"global"
],
"default": "instance",
"title": "State Scope",
"description": "Visibility level to read from (Instance, Case, or Global system-wide)."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
}{
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The unique key of the state variable."
}
},
"required": [
"key"
]
}{
"type": "object",
"description": "The retrieved value.",
"properties": {
"value": {
"type": "any",
"description": "The stored data."
}
}
}[
{
"port_id": "success",
"label": "Found",
"is_default": true,
"description": "Value retrieved successfully."
},
{
"port_id": "miss",
"label": "Not Found",
"description": "Keys does not exist or has expired."
},
{
"port_id": "error",
"label": "Error",
"description": "Storage connectivity error."
}
]Execution
- Execution
sync- Stateful
- Yes
- Retries (
retryOnFail) - No
- Capabilities
statepersistencereadstore- Tags
statedatabasepersistenceread
Notes and limits
- Key-value state lives in the workflow definition metadata (
kv_state), shared by every run of that workflow. The backend injects it at run start as$input.$kv_stateonly when the run uses the draft graph; runs of a published version receive none. Writes (meta.kv_stateof each step) are merged into the metadata after the run ends, so later nodes of the same run do not see them. There is no expiry. - Values are only written by
ops.dedupe,ops.checkpointandops.state.write, which all fail in the current runtime, sokv_stateonly holds what was stored earlier. - Leaving through
errordoes not fail the run: the engine follows the edges wired toerror, and if there are none the branch simply ends. - The
executionsettings (retryOnFail,maxTries,waitBetweenTries,continueOnFail,timeout_ms) are accepted, but neither this worker nor the engine applies them.
Reviewed against the orchestrator code · 31e874b · 2026-11-26