Composing Flows
A flow can invoke another flow. The flow.invoke operator treats a flow as a callable verb — same typed input, same typed output, same logging.
using: - zenvara/flow
steps: - $report: invoke: flow.invoke with: Flow: monthly-report Parameters: month: "2026-05" region: "EU"How it behaves
Section titled “How it behaves”- The called flow gets its own invocation ID and its own log stream.
- The calling flow waits synchronously for the result by default; async fire-and-forget is opt-in.
- The result is a normal payload value —
${report.<output-field>}— typed by the called flow’soutput:contract.
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 flow.invoke in a for-each: to run the same sub-flow once per item. |
| Retries with different parameters | Call the same flow twice with different Parameters: — 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.