Skip to main content
All CollectionsWorkflowsAction Guides
Action: Run Workflow (Inline)
Action: Run Workflow (Inline)
Updated over a month ago

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.

Did this answer your question?