Subflows for modular workflow logic
A Sub Flow is a modular segment of a workflow created separately from the main flow. It allows you to isolate specific logic, simplify complex automations, and reuse logic across workflows.
Each Sub Flow is built on its own canvas and connects to your main workflow using defined Input and Set Output nodes.
Why Use Sub Flows?
As workflows grow — incorporating document reading, AI logic, conditionals, and outputs — they can quickly become visually overwhelming and harder to manage. Using Sub Flows keeps your main canvas readable and reduces time spent scrolling, tracing lines, or resolving node issues.
Sub Flows help you:
- Simplify complexity by breaking logic into smaller, testable components
- Reduce visual clutter in the main Flow Editor
- Reuse logic (e.g., AI prompts, scoring, validations) across workflows
- Enable better collaboration, letting team members focus on different flow segments
- Improve testing and maintenance by isolating logic blocks
Common use cases include: summarization, data formatting, scoring logic, form validation, and branching/routing logic.
Creating a Sub Flow
A Sub Flow must be configured with clearly defined inputs and outputs so that it can communicate with the main workflow. This connection is handled through:
- An Input node inside the Sub Flow — receives data from the main workflow.
- A Set Output node — returns results back to the main workflow.
When calling the Sub Flow using a Sub Workflow node, the input/output port names must match exactly between both flows. This ensures a complete and functional data connection.
- Open any workflow inside your project.
- In the bottom-right corner of the Flow Editor, click + Add New Flow.
- Name your Sub Flow (e.g.
SanitizeText
). - Add an Input node (e.g.,
raw_text
). - Add your logic — AI Write, Text, etc.
- Add a Set Output node (e.g.,
clean_text
).
Using a Sub Flow - through the Subflow Node
Once your Sub Flow is built, it can be called from any other workflow using the Sub Workflow node. This node acts as a bridge between the parent flow and the modular logic inside your Sub Flow.
To connect them correctly, you must define Node Inputs and Node Outputs in the Sub Workflow node settings. These must exactly match the names used in the Sub Flow’s Input and Set Output nodes.
Just like handlebars ({{ }}
) in a Text node bind dynamic values, these port names bind input/output data between the main workflow and the Sub Flow.
In your main workflow:
- Add a Sub Workflow node in your main workflow.
- In the settings panel:
- Enter the Flow Name (e.g.,
Summarize_Website
). - Click + to add inputs — these must match the Input node names in the Sub Flow (
url
in this case). - Click + to add outputs — these must match the names defined in the Set Output node (
summary
here).
- Enter the Flow Name (e.g.,
- Use standard node connections to pass values into inputs and connect the returned outputs to further nodes (like Show or Set Form Data).
This ensures that the Sub Flow logic is properly triggered with the right data, and its result is routed back into your main workflow.
Best Practices
- Match names exactly (flow + ports)
- Keep each Sub Flow focused on a single task
- Reuse frequently across workflows
- Test logic inside Sub Flows before full integration
Example: Using a Sub Flow to Summarize a Website
To illustrate how Sub Flows work in practice, here’s a simple real-world example: summarizing the contents of a webpage.
This setup includes:
- Main Workflow – Passes a URL into a Sub Flow and displays the returned summary.
- Sub Flow (
Summarize_Website
) – Handles the full logic: reading the webpage, generating the summary using AI, and returning the result.
Main Workflow
The main flow consists of:
- A Plain Text node providing the URL
- A Sub Workflow node calling
Summarize_Website
, passing in the URL - A Show node that displays the returned summary
Sub Flow (Summarize_Website
)
Inside the Sub Flow:
- An Input node receives the
url
- A Read Webpage node fetches content
- A Text node builds the AI prompt
- An AI Write node summarizes the content
- A Set Output node returns the result as
summary
This example demonstrates how Sub Flows allow you to encapsulate logic into modular components, making your workflows easier to manage, reuse, and test independently.