Skip to content

Child workflows

Start a run of another workflow in the same app from a step, and wait for its result.

Updated View as Markdown

invoke starts a run of another workflow in the same app as a step, waits for it, and returns its output. Use it to reuse workflows, and to fan out beyond one run’s 1,000 steps.

const report = await step.invoke("report", { workflow: buildReport, input: { month: "2026-10" } })

workflow is a workflow object or its name. A failed child throws ChildFailed.

report, err := workflows.Invoke[Report](ctx, "report", "build-report", ReportInput{Month: "2026-10"})
if errors.Is(err, workflows.ErrChildFailed) { /* … */ }
report = await ctx.step.invoke("report", workflow="build-report", input={"month": "2026-10"})

A failed child raises ChildFailedError.

  • The child runs in the same app and project. Its input is JSON, at most 1 MiB.
  • A child starts exactly once: its run ID is derived from the parent’s run ID and the step, so a replay of the parent never starts a second child. A child has no run key.
  • A failed child fails the step with workflows.child_failed, whose cause is the child’s own error. The workflow can catch it.
  • Children nest at most 10 levels deep. An eleventh level fails the step without retrying.
  • Each child counts as one step of its parent, toward the 1,000 steps per run.
  • When a parent ends, whether it completed, failed, was cancelled or timed out, its children that are still running are cancelled. Cancelling a parent cancels its children too.
  • Retrying a failed parent re-examines its children: a child that has since ended delivers its outcome, and a failed or cancelled child is retried. See Retrying runs.

A child is a run like any other, with its own ID, steps and history.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close