Skip to content

Conversation

@TS-Eichhorn
Copy link

@TS-Eichhorn TS-Eichhorn commented Jan 9, 2026

🚀 Add Parallel Subflows Node for Flowise

Summary

This PR introduces a new Parallel Subflows tool node for Flowise that enables launching multiple subflows in parallel, with configurable concurrency, per-branch settings, robust timeout and failure handling, and rich timing insights. The node is designed to support fan-out / fan-in and multi-agent orchestration patterns.


✨ Key Features

  • Execute multiple Flowise subflows concurrently with a configurable maxParallel limit
  • Flexible flows configuration (array, map, or string list — automatically normalized)
  • Per-branch overrides for:
    • Timeouts
    • Variables
    • API keys
    • Question templates
  • Failure policies: continue (default) or fail-fast
  • Selectable outputs: text, json, or full execution metadata
  • Built-in timing metrics including total wall time, speedup calculation, and an ASCII timeline for quick performance insight
  • Lightweight templating support ({{input}}, {{vars.*}}) for dynamic prompts

🧩 What’s Included

  • ParallelSubflows.ts – Flowise tool node definition
  • core.ts – parallel execution and orchestration engine
  • Optional parallel.svg for UI / documentation visuals
  • Integration with Flowise /predict/{id} API

🧩 Use cases

  • Multi-agent LLM orchestration
  • Fan-out / fan-in reasoning patterns
  • Parallel analysis and comparison workflows
  • Performance benchmarking of subflows

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @TS-Eichhorn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a significant enhancement to Flowise by introducing a 'Parallel Subflows' tool node. This new capability allows users to orchestrate and execute multiple subflows simultaneously, greatly improving efficiency for complex workflows like multi-agent systems or fan-out/fan-in patterns. The node is highly customizable, offering granular control over individual subflow behaviors and comprehensive reporting on execution performance, making it easier to build and optimize sophisticated AI applications.

Highlights

  • Parallel Subflow Execution: Introduces a new tool node that enables launching multiple Flowise subflows concurrently with configurable concurrency limits.
  • Flexible Configuration: Supports various input formats for defining subflows (array of objects, array of strings, or map) with automatic normalization, and allows per-branch overrides for timeouts, variables, API keys, and question templates.
  • Robust Error Handling: Includes configurable failure policies ('continue' to collect all results including errors, or 'fail-fast' to abort on the first failure) and overall timeout settings.
  • Detailed Timing Insights: Provides built-in timing metrics such as total wall time, sum of branch times, max branch time, speedup calculation, and an ASCII timeline for quick performance visualization.
  • Dynamic Prompt Templating: Offers lightweight templating support ({{input}}, {{vars.*}}) for dynamic question generation within subflows.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Parallel Subflows tool, which is a great addition for orchestrating parallel workflows in Flowise. The implementation is robust, with features like concurrency control, timeouts, and detailed timing metrics.

My review focuses on a critical security vulnerability and some improvements to the code and documentation for clarity and correctness.

Key points:

  • Security: There's a critical code injection vulnerability in ParallelSubflows.ts due to the use of the Function constructor for parsing JSON. I've suggested replacing it with a safer parser.
  • Code Quality: I found some dead code in core.ts that should be removed.
  • Documentation: The README.md has some inconsistencies in file paths and a minor typo that should be corrected to avoid confusion for users.

Overall, this is a well-designed feature. Addressing these points will make it even better.

Comment on lines +42 to +49
function convertToValidJSONString(inputString: string) {
try {
const obj = Function('return ' + inputString)()
return JSON.stringify(obj, null, 2)
} catch {
return ''
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

The use of Function('return ' + inputString)() is a major security vulnerability as it can execute arbitrary JavaScript code, equivalent to eval(). This could lead to Remote Code Execution (RCE).

To safely parse lenient JSON (with unquoted keys, single quotes, etc.), please use a library like json5, which seems to be an existing dependency in this project.

First, add the following import at the top of the file:

import JSON5 from 'json5'

Then, apply the suggested code change.

Suggested change
function convertToValidJSONString(inputString: string) {
try {
const obj = Function('return ' + inputString)()
return JSON.stringify(obj, null, 2)
} catch {
return ''
}
}
function convertToValidJSONString(inputString: string) {
try {
const obj = JSON5.parse(inputString)
return JSON.stringify(obj, null, 2)
} catch {
return ''
}
}

Comment on lines +26 to +34
packages/components/nodes/tools/ParallelSubflows/
packages/components/nodes/utilities/ParallelSubflows/
```

2. Add the files:

- `ParallelSubflows.ts` → `packages/components/nodes/tools/ParallelSubflows/ParallelSubflows.ts`
- `core.ts` → `packages/components/nodes/utilities/ParallelSubflows/core.ts`
- (Optional) `parallel.svg` in the repo root (used in this README)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The installation instructions contain incorrect file paths for core.ts and parallel.svg. This can be confusing for users trying to install this custom node.

  • The core.ts file should be in .../tools/ParallelSubflows/, not .../utilities/ParallelSubflows/.
  • The parallel.svg file should also be placed within the .../tools/ParallelSubflows/ directory, not the repo root.

The suggested change corrects these paths and removes the instruction to create an unnecessary utilities directory.

Suggested change
packages/components/nodes/tools/ParallelSubflows/
packages/components/nodes/utilities/ParallelSubflows/
```
2. Add the files:
- `ParallelSubflows.ts``packages/components/nodes/tools/ParallelSubflows/ParallelSubflows.ts`
- `core.ts``packages/components/nodes/utilities/ParallelSubflows/core.ts`
- (Optional) `parallel.svg` in the repo root (used in this README)
packages/components/nodes/tools/ParallelSubflows/
  1. Add the files:
  • ParallelSubflows.tspackages/components/nodes/tools/ParallelSubflows/ParallelSubflows.ts
  • core.tspackages/components/nodes/tools/ParallelSubflows/core.ts
  • (Optional) parallel.svgpackages/components/nodes/tools/ParallelSubflows/parallel.svg


3. Build & run Flowise as you normally do (e.g., `pnpm build` then start the app).
4. In the Flowise UI, add the **Parallel Subflows** node to your flow.
Addional information related to custom nodes in flowise can be found here: https://docs.flowiseai.com/contributing/building-node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo here. It should be 'Additional' instead of 'Addional'.

Suggested change
Addional information related to custom nodes in flowise can be found here: https://docs.flowiseai.com/contributing/building-node
Additional information related to custom nodes in flowise can be found here: https://docs.flowiseai.com/contributing/building-node

Comment on lines +393 to +394
if (typeof (globalThis as any).AbortSignal?.timeout === 'function') {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This if block is empty and has no effect. It appears to be leftover code and should be removed to improve code clarity and maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant