Skip to main content
An invoke starts one separately published procedure as a child run, waits for it to finish, and binds its result. Use it to reuse a whole procedure, such as a shared notice or review process, with its own versions. To run a single function or effect, use call instead.

Syntax

Follow whichever version is live when the step runs:
invoke id=send-notice
Or pin one exact published version:
invoke id=send-notice

Fields

These selectors are not valid: an ID without catalog:, latest, version 0 or below, version ranges, local file paths, and references or other expressions.

Example

A nonpayment cancellation procedure hands the notice to a separately published procedure:
nonpayment-cancellation.procedure.md
The child, cancellation-notice, declares inputs policy_number and reason and one output with policyNumber and sent fields. The parent reads $notice.sent from that output.

On retry and resume

  • The parent waits. The parent can’t move past the invoke until the child finishes or fails. There is no fire-and-forget form.
  • @N is fixed. An exact selector always runs those exact child bytes, for every run of the parent.
  • /live is resolved once per step. The first time a run reaches the step, it resolves the live version to one exact version and records that choice. Retries and resumes use the recorded child and never resolve /live again. A running or retried child stays on the version it started with.
  • Compatible moves need no republish. Publishing the parent records the child’s input and output contracts, not a version. When /live moves to a version with the same contracts, new runs of the parent use it without republishing the parent.
  • Incompatible moves fail before the child starts. If the live version’s input or output contract no longer matches what the parent recorded, the step fails before any child starts.
  • Failures fail the step. A malformed child result or a technical child failure fails the invoke. Put business outcomes such as “rejected” in the child’s typed output instead.
  • Nesting is bounded. A chain of invokes can be at most eight levels deep. A procedure can’t invoke itself through /live, and a cycle back to a procedure already running above the child is refused when the child would start.

Common errors

At run time, an invoke can also fail because the child version isn’t available, its contracts no longer match, the nesting limit is reached, or a cycle would form.

See also