Run Workflow Block

Execute a sub-workflow within a parent workflow

The Run Workflow Block allows you to execute a separate workflow within your main workflow. This block is ideal for running sub-processes and reusing common processes across multiple workflows.


Configurations

App

Select the AI Worker containing the workflow you want to run.

  • Use the dropdown to choose the appropriate AI Worker.

  • Ensure the selected AI Worker contains the workflow you want to execute.

Workflow

Choose the specific workflow within the selected AI Worker to execute.

  • Select from available workflows in the chosen AI Worker.

  • For modular workflows, ensure the selected workflow is designed for integration.

Launch Variables

Define the values to pass to the required variables in the selected workflow.

  • Assign static values or use variables from the current workflow.

Example:

  • Variable: customer_name

  • Value: {{userName}}

Output Variables

Map the outputs of the sub-workflow back to variables in the parent workflow.

  • Assign the variable_name you want to store the sub-workflow's output in.

  • Enter the variable_name without curly braces.

Example:

  • Variable: customer_profile

  • Mapped to: customer_info in the parent workflow


Preparing the Sub-Workflow

Before a sub-workflow can be used in the Run Workflow Block, it must be configured with:

Launch Variables:

Define the launch variables that the parent workflow will provide. Go to the sub-workflow you'd like to run and add Launch Variables in the Start Block of the sub-workflow.

Example Launch Variables:

  • customer_name: The parent workflow will pass the customer name down to the sub-workflow.

  • order_id: The parent workflow will pass the ID of the customer's order down to the sub-workflow.

Structured Outputs:

Define the Return Data that the sub-workflow will return to the parent workflow. Add these variables to the sub-workflow’s Terminator Block under Return Data -> JSON Output.

Example Return Data:

  • customer_profile: Returns customer details retrieved from the sub-workflow.

  • order_status: Returns the status of the processed order from the sub-workflow.

Note: If a workflow lacks these configurations, you will see an error message:

"The selected workflow has not been configured with launch variables and structured outputs."


Best Practices

  • Ensure Variable Alignment: Make sure that required variables in the sub-workflow are properly assigned with values during execution.

  • Optimize Your Workflows: Use this block to simplify complex workflows by breaking them into manageable, reusable components.

  • Test Input and Output Mapping: Verify that all variables are passed correctly between the parent and sub-workflows.

Last updated