Overview
The Run Workflow (Inline) action allows you to execute another workflow from within your current workflow, passing inputs from the current workflow into a nested child workflow and retrieving desired outputs from that child workflow back into the parent. This powerful orchestration capability enables you to build complex, multi-step workflows by chaining multiple reusable workflow components together. You can conditionally execute the child workflow based on logical conditions, loop through arrays of inputs by passing them into the child workflow, and selectively retrieve only the outputs you need - all streamlining your workflow and reducing redundant data. With Run Workflow (Inline), you can construct sophisticated workflows to automate virtually any process involving multiple steps and data transformations.
Usage Examples
Modularity - A key benefit of Run Workflow (Inline) is how it allows you to break up repeatable tasks into reusable chunks. A set of actions you run frequently in a variety of different workflows such as:
Performing research
Creating outlines
Executing API calls
Can be abstracted into a child workflow with Run Workflow (Inline) rather than having to configure the same prompts over and over again. You’ll be able to make updates to these repeatable tasks much faster and more consistently when you only need to maintain them in one place!
Looping - When you need to repeat a task a variable number of times based on input, Array Mode is your best friend. Abstract the task you need to repeat into a child workflow for a much faster, cost-effective method of repetition! You can use Array Mode to:
Scrape a variable number of links and summarize their webpages
Write thank you notes for every person on a guest list
Translate every item from an array of product information
Inputs
Select Workflow - This is the specific workflow that you want to run inline within your current workflow. You will be presented with a list of available workflows to choose from.
For example, you could choose the "Blog Post Summary" workflow.
Inputs - After selecting the workflow, you will be prompted to map the inputs required by that workflow. This maps data from your current workflow (outputs from previous actions, workflow inputs, system variables etc.) to the input parameters of the child workflow you are running inline.
Example: For the "Blog Post Summary" workflow, you may need to map the blog post text output from a previous "Extract Text" action to the "Blog Post" input parameter.
Select Outputs - Here you can select which of the output variables from the child workflow you want to pass back to the parent workflow after execution. This allows you to only take the outputs you need.
Example: For the "Blog Post Summary" workflow, you may only want the "Summary" output passed back to use in subsequent steps.
Advanced Inputs
Run Conditionally - This allows you to set conditions on whether the child workflow should actually run or not based on evaluating a text expression against variables from the parent workflow.
Example: You could set "conditional run" to the text "contains_product_description" and have it only run the "Blog Post Summary" workflow if a variable from earlier contains that text.
Stop Message - If the conditional run expression evaluates to false, this is the message that will be logged for that workflow run instance.
Array Mode - This allows you to pass in an array or list to the child workflow and have it run once per item in a loop, collecting all the outputs. Keep in mind that the parent workflow will not proceed until the child workflow has been run for each element passed from the list. This can lead to long runtimes and should be used carefully.
Example: you could extract a list of URLs, pass them in via array mode to a web scraping workflow, and get back structured data for each URL.
Outputs
The Run Workflow (Inline) action will return whatever outputs have been selected from the child workflow in an array. You can use these outputs in any subsequently run actions of the parent workflow.
Troubleshooting
Workflow Timeouts - If the selected child workflow is labor-intensive or if a large list is passed in Array Mode, your workflow may pass the maximum allotted time for a single workflow run and fail. Try to break up the task into smaller increments or consider using faster models to improve the efficiency of the child workflow.
Selecting Outputs - All outputs from the child workflow should be available to select from the Run Workflow (Inline) action. If you are not seeing an output, check your child workflow and ensure the action you’re looking for is set up properly. Keep in mind that some actions return array data and may need additional processing before being used in subsequent workflow actions.
Conditional Run - If your run conditions are not passing, try removing the condition and testing its output in Test Mode- you likely have small discrepancies between the output of your comparison text and the value you are actually comparing to.
Updating Outputs of Child Workflows - If an output used by the parent workflow from a child workflow is updated or renamed, it is necessary to go back to the instance of the Run Inline step to reference the new output name. This may also require updating the references to this output if it is referenced in other steps of the workflow.
Unable to get a predictable value for comparisons on conditional runs - The categorize action can be used to generate a predictable and stable response that can be used for evaluating a condition. This is a best practice that greatly simplifies conditional runs. The simplest way to do this is to take a value and categorize “TRUE” or “FALSE” with a description that describes your condition.
Related Actions
Run Workflow - This is a standard action to run another workflow, but unlike Run Workflow (Inline), it simply returns the run ID and workflow config ID of the triggered child workflow run. It does not directly return the outputs. The child workflow run will appear in the run history separately, while Run Workflow (Inline) handles it transparently within the parent workflow.
Categorize Text - This action can categorize input text data into predefined categories, such as determining whether a block of product information is a pair of pants or a shirt, allowing different follow-up workflows to be executed based on the categorization.
Send API Request - This action can make HTTP calls to external REST APIs. You can use it to execute different code paths in the workflow based on some conditions.
Extract Data from Text - This action can extract structured data like lists, tables or specific entities from unstructured text input. The example shows using it to extract a list of URLs from text, which can then be passed as an Array Mode input to the Run Workflow (Inline) action to run the child workflow for each URL iteratively.