Skip to main content
A parent workflow can start a child workflow and durably wait for its result using step.runWorkflow(). This lets you compose complex processes from smaller, reusable workflows — like splitting an order pipeline into separate payment and shipping workflows. The parent sleeps while the child runs, freeing its worker slot. When the child finishes, the parent automatically resumes and receives the child’s output.

Basic Usage

Timeout

By default, the parent waits up to 1 year for the child to finish. You can customize this with options.timeout:
timeout accepts a duration string, a number of milliseconds, or a Date:
When the timeout is reached, the parent step fails but the child workflow keeps running independently. The child is not automatically canceled.

Workflow Spec

The first argument accepts a workflow spec:

Step Name

Set options.name to control the durable step name. If omitted, OpenWorkflow uses the target workflow name.

Error Handling

If the child workflow fails, the parent workflow step also fails:
If the child workflow is canceled, the parent workflow step fails with an error indicating the child was canceled.
Workflow steps do not retry automatically. The child workflow is responsible for its own retries. If the child fails permanently, the error propagates to the parent.

Parallel Child Workflows

Start multiple child workflows concurrently with Promise.all: