Skip to content

Implement regex operation for Agentflow Condition#5732

Open
DEVELOPER-DEEVEN wants to merge 1 commit intoFlowiseAI:mainfrom
DEVELOPER-DEEVEN:fix/agentflow-condition-regex
Open

Implement regex operation for Agentflow Condition#5732
DEVELOPER-DEEVEN wants to merge 1 commit intoFlowiseAI:mainfrom
DEVELOPER-DEEVEN:fix/agentflow-condition-regex

Conversation

@DEVELOPER-DEEVEN
Copy link

@DEVELOPER-DEEVEN DEVELOPER-DEEVEN commented Feb 9, 2026

Summary

  • add regex handler to the Agentflow Condition backend compare map so the frontend "Regex" option executes instead of throwing
  • support simple /pattern/flags parsing and safely fall back to plain patterns; invalid regex input returns false instead of crashing
  • guard against unknown operations before execution to avoid runtime TypeErrors

Fixes #5650.

Testing

  • not run (not configured in this environment)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @DEVELOPER-DEEVEN, 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 significantly enhances the Agentflow Condition node by integrating regular expression capabilities, allowing for more flexible and powerful conditional logic. It introduces a new regex operator that not only performs pattern matching but also includes comprehensive error handling to ensure stability when dealing with potentially malformed regex patterns. Furthermore, the changes improve the overall resilience of the condition evaluation process by preventing crashes when an unrecognized comparison operation is encountered.

Highlights

  • Regex Operation Added: A new regex comparison operation has been introduced to the Agentflow Condition backend, allowing for pattern matching within conditions.
  • Robust Regex Handling: The implementation includes robust parsing for regex patterns and flags (e.g., /pattern/flags). It gracefully handles invalid regex input by returning false instead of causing a crash.
  • Error Prevention for Unknown Operations: A safeguard has been added to prevent runtime TypeErrors by checking if a comparison operation exists before attempting to execute it. Unknown operations are now safely skipped.
Changelog
  • packages/components/nodes/agentflow/Condition/Condition.ts
    • Added a new regex function to the compareOperationFunctions map to enable regular expression comparisons.
    • Implemented logic within the regex function to parse raw pattern strings, extract regex patterns and flags, and handle RegExp creation with a try-catch block to prevent errors from invalid patterns.
    • Introduced a null check for compareOperationFunctions[operation] before execution, ensuring that unknown operations do not lead to runtime errors.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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 regex operation for Agentflow Conditions and adds a safeguard against unknown operations. The implementation of the regex handler is robust, correctly parsing patterns with and without flags, and includes error handling for invalid regex expressions. The addition of a check for unknown operations prevents potential runtime errors, improving the overall stability of the code. The changes are well-implemented and align with the goals stated in the pull request description.

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.

Bug: "Regex" operation in Condition node is not implemented in backend

1 participant