Composing Flows
A flow can invoke another flow. Declare the child as a - flow/<name> entry in using:, then invoke it by its bare alias — same typed input, same typed output, same logging.
using: - flow/monthly-report
output: summary: !str
steps: - $report: invoke: monthly-report with: month: "2026-05" region: "EU"
- return: summary: "${report.summary}"How it behaves
Section titled “How it behaves”- The called flow gets its own run ID and its own log stream.
- The calling flow blocks until the child terminates — a sub-flow run is always synchronous; the default wait is 5 minutes, overridable per step with
timeout:. - The result is a normal payload value —
${report.<output-field>}— typed by the called flow’soutput:contract. A named step ($report:) merges that output into the parent payload; a bare unnamed- invoke: monthly-reportruns the child but drops its output.
When to use it
Section titled “When to use it”| Pattern | How |
|---|---|
| Shared sub-pipelines | Factor a common sequence (e.g. “normalise and validate a customer record”) into its own flow and call it from several places. |
| Fan-out | Wrap the sub-flow invoke: in a for-each: do: to run the same sub-flow once per item. |
| Retries with different parameters | Call the same flow twice with different with: values — e.g. a primary region then a fallback. |
Because the called flow has a typed output: contract just like any other, the composition is checked the same way a single flow is — references into ${report.…} are validated at compile time.