Subworkflow

Calls another workflow as a step in the current workflow. The target workflow runs synchronously — the parent workflow pauses, the subworkflow executes, and the parent resumes with the result.

When to Use

Use Subworkflow when:

  • You want to reuse logic shared across multiple workflows
  • A workflow has grown too large and you want to split it into composable pieces
  • You want to call a standalone workflow from within a larger pipeline

The target workflow must have a Manual Trigger with allowWorkflowInvocation enabled.

Inputs

HandleTypeDescription
inputanyData passed to the subworkflow's trigger payload. Optional.

Output

HandleTypeDescription
resultanyResult returned from the subworkflow's Return node.

The result is accessed in downstream nodes as {{ subworkflow.result }}.

Settings

SettingTypeRequiredDescription
workflowIdstringYesID of the target workflow to execute. Paste it from the target workflow's URL.

The target workflow must:

  1. Use a Manual Trigger node as its entry point
  2. Have allowWorkflowInvocation enabled on the Manual Trigger node
  3. Include a Return node at its exit point with the value to return

Example

Canvas

Parent workflow that validates and enriches data using two separate subworkflows:

Webhook → Subworkflow (validate-user-wf) → Subworkflow (enrich-profile-wf) → Send Email

Subworkflow settings:

  • Workflow ID: paste the target workflow ID from its URL

validate-user-wf structure:

Manual Trigger → HTTP Request (call auth service) → If (input.status == 200)
    → true:  Return (forwards user data)
    → false: Stop

Access the subworkflow's output in the parent:

{{ subworkflow.result.email }}
{{ subworkflow.result.plan }}

TSL

import webhook from @tensorify/webhook-trigger:4.0.0
import validate from @tensorify/subworkflow:3.0.0
import enrich from @tensorify/subworkflow:3.0.0
import send_email from @tensorify/resend-send-email:1.0.0

node trigger @tensorify/webhook-trigger:4.0.0 {
    path = "/users"
    method = "POST"
    provider = "generic"
}

node validate_user @tensorify/subworkflow:3.0.0 {
    workflowId = "wf_validate_user_abc123"
}

node enrich_profile @tensorify/subworkflow:3.0.0 {
    workflowId = "wf_enrich_profile_def456"
}

node notify @tensorify/resend-send-email:1.0.0 {
    to = "{{ enrich_profile.result.email }}"
    subject = "Welcome"
}

trigger.payload -> validate_user.input
validate_user.result -> enrich_profile.input
enrich_profile.result -> notify.input

Error Handling

Subworkflow has a hidden On Error control output branch. Enable it via the "Error output handle" toggle at the bottom of the settings panel.

The error branch fires when:

  • The subworkflow fails (a node throws, no Return fires)
  • The target workflow cannot be found or is not invocable
  • Any runtime exception occurs during subworkflow execution

Connect the error output to a fallback Return node, a notification action, or a Stop node to handle failures gracefully. Without the error branch enabled, a subworkflow failure halts the parent workflow at the Subworkflow node.

Common Gotchas

  • Target must have Manual Trigger: If the target workflow uses a Webhook or API Endpoint trigger, calling it as a subworkflow will fail at runtime.
  • Circular calls: Do not call workflow A from workflow B if workflow B is already called from A. Circular subworkflow chains will hit a recursion limit.
  • Only the Return body propagates: Custom HTTP status codes set in the child workflow's Return node are not passed to the parent — only the body value becomes result. If the child workflow does not reach a Return node, the parent receives null.
  • Synchronous execution: The parent workflow blocks until the subworkflow completes. Long-running subworkflows increase total execution time.

See Also

  • Manual Trigger — configure the target workflow's entry point
  • Return — return a value from the subworkflow
  • If — branch on subworkflow results in the parent
On this page