Skip to content

Sub-workflows

Build large automations from smaller, reusable workflows. A Sub-Workflow node runs another workflow as one step. The Chain node manages workflows from inside a workflow. Both sit in the palette under Flow Control.


Sub-Workflow

What: Runs another workflow, waits for it to finish, and returns its result.

The Sub-Workflow node's panel in the editor: the header with the node's icon and name, and its Settings tab.The Sub-Workflow node's panel in the editor: the header with the node's icon and name, and its Settings tab.

Ports: in input; out output, error.

Configuration:

Field Notes
workflowId Required. A saved workflow in your workspace.
inputMapping {childField: source}. Narrow or rename what the child receives. Empty: the child gets everything that arrived at this node.
outputMapping {parentField: source}. Shape what comes back.
maxDepth Maximum nesting depth, to stop runaway recursion. Default 10.
passIncomingItems Send every incoming item to the child, not only the merged data. Default off.
mapOutputsFromChild Resolve outputMapping against the child's nodes, for example {{ $node["Inner"].output }}, and add the mapped fields to the child's result. Default off.

In the child workflow, read what the parent sent with {{ $trigger.<field> }}.

Mapping values are either a field name on the source data or a literal value. An expression such as {{ $input.customerId }} is resolved before the node runs and is used as the value.

Example: The parent workflow calls the sub-workflow and uses its result:

Workflow: Contact signed up to Enrich contact, Enrich contact to Update contact Contact signed upAPI/Webhook TriggerEnrich contactSub-Workflow Update contactHubSpot CRM

The sub-workflow ("Enrich contact") reads what it was given from $trigger:

Workflow: Start to Look up company, Look up company to Shape resultStartStart the workflow Look up companyHTTP RequestShape resultSet

Look up company calls your enrichment API with {{ $trigger.email }}, and Shape result returns { email, company, role }.

Use when:

  • Reusing logic ("enrich a contact") in several parent workflows.
  • Breaking a 50-node workflow into parts people can read.
  • Recursion, with care. maxDepth stops it.

Tips:

  • A failure in the child goes to the node's error port, or follows the node's error mode.

Convert a selection to a sub-workflow

You can turn part of an existing workflow into a sub-workflow without rebuilding it:

  1. Select the nodes on the canvas.
  2. Right-click and choose Convert selection to sub-workflow.
  3. Name the new workflow and confirm.

Flero moves the nodes into a new workflow and puts a Sub-Workflow node in their place, wired so that it behaves exactly like the nodes it replaces. The current workflow is saved when you convert.

  • Triggers stay in the parent workflow.
  • An AI Agent moves together with its tools and guards.
  • The selection must have a single exit. If it can't be extracted safely, the dialog lists what to change.

See Convert to sub-workflow for the full walkthrough.

The Convert to sub-workflow dialog over the canvas: it will move 3 nodes into a new workflow, suggests the name Parse invoice (sub-workflow), and offers Cancel and Convert. The bar at the bottom of the canvas reads 3 selected.The Convert to sub-workflow dialog over the canvas: it will move 3 nodes into a new workflow, suggests the name Parse invoice (sub-workflow), and offers Cancel and Convert. The bar at the bottom of the canvas reads 3 selected.

Chain

What: Manages Flero workflows from inside a workflow: create, update, run, stop, delete, list, get, clone, export, import, validate and analyse. Its palette tagline is "Run subagents".

Ports: in input; out output.

Configuration: operation (required: create, update, execute, stop, delete, list_workflows, get, clone, export, import, validate, analyze), plus the fields that operation needs.

To run one fixed workflow as a step, Sub-Workflow is simpler.


Tips & gotchas

  • Keep child inputs explicit. An inputMapping documents what the child needs, and stops unrelated fields leaking in.
  • Recursion has a ceiling. A sub-workflow that calls itself stops at maxDepth.
  • The child must be saved. workflowId has to point to a real, saved workflow.


Found something out of date? This page lives in the Flero docs content set.