Workflow Chain
Invokes another workflow and optionally waits for its result.
Starts another workflow of the same organization by its definition id, passing a payload and a chain context, and either waits for its terminal result (sync) or continues once it is dispatched (async).
This operator enables peer-to-peer workflow chaining. It triggers a target workflow and can operate in synchronous (wait for result) or asynchronous (fire-and-forget) mode.
Features:
- Sync Mode: Waits for the target workflow to complete and returns its result.
- Async Mode: Fires the target workflow and continues immediately with the instance ID.
- Traceability: Correlation ID links both workflow instances for audit and debugging.
- Payload Forwarding: Define exactly what data to pass to the target workflow.
Use Cases:
- Composing complex processes from reusable workflow modules.
- Delegating specialized processing (e.g., validation, enrichment) to dedicated workflows.
- Fan-out patterns where one workflow triggers multiple independent workflows.
How it works
- Resolves the config. Fails through
errorwhentarget_flow_definition_idis empty. The payload sent is the configuredpayloador, when it is not set, the node input ($json). - Resolves the organization from the run (
$organization_id, elseorganization_idin the run input or the node input) and the environment of the child:prodwhen the parent runs a published version,testotherwise. - Builds the chain context: caller definition id, instance id, slug and node id, a new
correlation_id(chain-…) and theroot_flow_instance_result_idof the whole chain, inherited unchanged from the parent when the parent was itself chained. - Asks the backend to run the target. In
prodthe backend uses the target's default published version (or its latest one); the child receives$input={ data: <payload>, chain_context }. sync: consumes a streaming response that relays the child's per-node progress to the parent's timeline and ends with the terminal result.async: returns once the child is dispatched.- A 2xx answer leaves through
outwith{ instance_id, status, result, steps: null, correlation_id }; anything else througherror.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-score-applicant",
"label": "Score applicant",
"operator_slug": "workflow.chain",
"operator_version": "1.0.0",
"config": {
"target_flow_definition_id": "<flow_definition_id>",
"payload": {
"applicant_id": "{{ $json.applicant_id }}",
"amount": "{{ $json.amount }}"
},
"execution": {
"mode": "sync",
"timeout_ms": 30000
}
}
}{
"ok": true,
"data": {
"instance_id": "<flow_instance_id>",
"status": "completed",
"result": {
"id": "<flow_instance_result_id>",
"flow_instance_id": "<flow_instance_id>",
"correlation_id": "<correlation_id>",
"status": {
"id": 5,
"name": "completed",
"title": "Completed",
"color": "#2e7d32"
},
"outcome_category": "success",
"duration_ms": 1840,
"error_summary": null,
"final_output_envelope": {
"node_id": "node-score",
"port": "out",
"payload": {
"score": 0.92,
"approved": true
}
},
"metrics": {}
},
"steps": null,
"correlation_id": "chain-8f3k2m9q1x7v4b6n0z5c"
},
"meta": {
"target_flow_definition_id": "<flow_definition_id>",
"mode": "sync",
"correlation_id": "chain-8f3k2m9q1x7v4b6n0z5c"
},
"port": "out"
}Configuration
-
target_flow_definition_idstring Required -
The workflow to invoke when this node executes.
-
payloadobject Optional -
Data to send to the target workflow. Use {{expressions}} to reference upstream node outputs. If empty, the current node input ($json) is forwarded.
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.
-
target_flow_definition_id - The only way to pick the target: a flow definition id of the same organization. The worker does not resolve targets by slug.
-
payload - Resolved as a templated object and sent as the child's
$input.data. When the node has nopayload, the node input is sent as is. -
execution.timeout_ms - Default 30000 ms in the code (the schema shows 300000, which the code does not apply). In
syncstreaming it is an idle limit, reset by every event and keep-alive, so a long child does not time out while the backend keeps the stream alive. Ignored inasync, which uses 10 s.
Output ports
out default The backend accepted the chain. In sync, status is the child's final status name and result a trimmed run result (its own status is a status object) whose final_output_envelope.payload holds the child's last output; this port also fires when the child ended failed, so check status. In async, status is running and result is null. steps is always null; meta carries target_flow_definition_id, mode and correlation_id.
{
"instance_id": "<flow_instance_id>",
"status": "completed",
"result": {
"id": "<flow_instance_result_id>",
"flow_instance_id": "<flow_instance_id>",
"correlation_id": "<correlation_id>",
"status": {
"id": 5,
"name": "completed",
"title": "Completed",
"color": "#2e7d32"
},
"outcome_category": "success",
"duration_ms": 1840,
"error_summary": null,
"final_output_envelope": {
"node_id": "node-score",
"port": "out",
"payload": {
"score": 0.92,
"approved": true
}
},
"metrics": {}
},
"steps": null,
"correlation_id": "chain-8f3k2m9q1x7v4b6n0z5c"
}error The backend rejected the chain (data is { status, message, correlation_id }), the call failed ({ error, response }), or it timed out ({ error: "TIMEOUT", message }). For a missing target, backend URL or organization the envelope has no data, so the next node receives { ok: false, errors: [...], port: "error" }.
{
"status": 500,
"message": "No published version found for the target workflow",
"correlation_id": "chain-8f3k2m9q1x7v4b6n0z5c"
}In expressions
What a later node can read from this node's output with $("Workflow Chain").item.json.<path> (write your node's label instead of Workflow Chain). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Workflow Chain").item.json.instance_idThe ID of the created workflow instance. | ||
$("Workflow Chain").item.json.statusFinal status of the target workflow (sync) or "running" (async). | ||
$("Workflow Chain").item.json.resultThe target workflow result (sync mode only). | ||
$("Workflow Chain").item.json.result.id | — | |
$("Workflow Chain").item.json.result.flow_instance_id | — | |
$("Workflow Chain").item.json.result.correlation_id | — | |
$("Workflow Chain").item.json.result.status | — | |
$("Workflow Chain").item.json.result.outcome_category | — | |
$("Workflow Chain").item.json.result.duration_ms | — | |
$("Workflow Chain").item.json.result.error_summary | — | |
$("Workflow Chain").item.json.result.final_output_envelope | — | |
$("Workflow Chain").item.json.result.metrics | — | |
$("Workflow Chain").item.json.steps | — | |
$("Workflow Chain").item.json.correlation_id | — |
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
Missing target_flow_definition_id | error | No target workflow selected. |
Cannot resolve organization_id from execution state | error | The run carries no organization in its state, its input or the node input. Include organization_id in the input when you start the run. |
No published version found for the target workflow | error | The parent runs a published version (prod) but the target has none. Publish the target workflow first. |
Workflow chain timed out waiting for target workflow | error | In async the dispatch took more than 10 s; on the non-streaming sync path the child took longer than execution.timeout_ms. |
Workflow execution failed: <detail> | error | The backend could not run the child (for example, the target graph has no nodes). |
Input contract
-
target_flow_definition_idstring Required -
payloadobject Optional
Output contract
-
instance_idstring Optional -
The ID of the created workflow instance.
-
statusstring Optional -
Final status of the target workflow (sync) or "running" (async).
-
resultobject Optional -
The target workflow result (sync mode only).
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": "workflow.chain",
"name": "Workflow Chain",
"category": "workflow",
"version": "1.0.0",
"description": "Invokes another workflow and optionally waits for its result.\n\n This operator enables peer-to-peer workflow chaining. It triggers a target workflow and can operate in synchronous (wait for result) or asynchronous (fire-and-forget) mode.\n\n **Features:**\n - **Sync Mode:** Waits for the target workflow to complete and returns its result.\n - **Async Mode:** Fires the target workflow and continues immediately with the instance ID.\n - **Traceability:** Correlation ID links both workflow instances for audit and debugging.\n - **Payload Forwarding:** Define exactly what data to pass to the target workflow.\n\n **Use Cases:**\n - Composing complex processes from reusable workflow modules.\n - Delegating specialized processing (e.g., validation, enrichment) to dedicated workflows.\n - Fan-out patterns where one workflow triggers multiple independent workflows.",
"capabilities": [
"workflow",
"chain",
"composition",
"orchestration"
],
"config_schema": {
"type": "object",
"properties": {
"target_flow_definition_id": {
"type": "string",
"title": "Target Workflow",
"description": "The workflow to invoke when this node executes.",
"x-ui-widget": "flow-definition-picker"
},
"payload": {
"type": "object",
"title": "Payload",
"description": "Data to send to the target workflow. Use {{expressions}} to reference upstream node outputs. If empty, the current node input ($json) is forwarded."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"mode": {
"type": "string",
"enum": [
"sync",
"async"
],
"default": "sync",
"title": "Execution Mode",
"description": "Sync: wait for the target workflow to complete and return its result. Async: dispatch and continue without waiting."
},
"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
},
"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
}
}
}
},
"required": [
"target_flow_definition_id"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"target_flow_definition_id": {
"type": "string"
},
"payload": {
"type": "object"
}
},
"required": [
"target_flow_definition_id"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"instance_id": {
"type": "string",
"description": "The ID of the created workflow instance."
},
"status": {
"type": "string",
"description": "Final status of the target workflow (sync) or \"running\" (async)."
},
"result": {
"type": "object",
"description": "The target workflow result (sync mode only)."
}
}
},
"ports": [
{
"port_id": "out",
"label": "Completed",
"description": "Target workflow completed successfully (sync) or dispatched (async).",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Target workflow failed, timed out, or could not be found.",
"is_default": false,
"supports_condition": true
}
],
"execution_mode": "async",
"required_resources": [],
"compatible_worker_pools": [
"standard-io"
],
"tags": [
"workflow",
"chain",
"composition",
"orchestration"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"target_flow_definition_id": {
"type": "string",
"title": "Target Workflow",
"description": "The workflow to invoke when this node executes.",
"x-ui-widget": "flow-definition-picker"
},
"payload": {
"type": "object",
"title": "Payload",
"description": "Data to send to the target workflow. Use {{expressions}} to reference upstream node outputs. If empty, the current node input ($json) is forwarded."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"mode": {
"type": "string",
"enum": [
"sync",
"async"
],
"default": "sync",
"title": "Execution Mode",
"description": "Sync: wait for the target workflow to complete and return its result. Async: dispatch and continue without waiting."
},
"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
},
"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
}
}
}
},
"required": [
"target_flow_definition_id"
]
}{
"type": "object",
"properties": {
"target_flow_definition_id": {
"type": "string"
},
"payload": {
"type": "object"
}
},
"required": [
"target_flow_definition_id"
]
}{
"type": "object",
"properties": {
"instance_id": {
"type": "string",
"description": "The ID of the created workflow instance."
},
"status": {
"type": "string",
"description": "Final status of the target workflow (sync) or \"running\" (async)."
},
"result": {
"type": "object",
"description": "The target workflow result (sync mode only)."
}
}
}[
{
"port_id": "out",
"label": "Completed",
"description": "Target workflow completed successfully (sync) or dispatched (async).",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Target workflow failed, timed out, or could not be found.",
"is_default": false,
"supports_condition": true
}
]Execution
- Execution
async- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
workflowchaincompositionorchestration- Tags
workflowchaincompositionorchestration
Notes and limits
- If the
syncstream fails (anerrorevent, a close without result, or the idle limit), the worker resends the request to the non-streaming endpoint, which can start the child a second time. Design chained workflows to be safe to repeat. - Correlation:
correlation_idlinks parent and child;root_flow_instance_result_idis propagated unchanged through every level, so the deepest child can report the id of the entry run. - The child's full step list is never copied into the parent: read outputs from
result.final_output_envelope.payloadand open the child run byinstance_idfor detail. - If the target is paused for that environment, the backend answers with its pause response instead of running it.
Reviewed against the orchestrator code · 31e874b · 2026-11-26