Business rules scripting

Scripting LanguageLanguage VersionScripting EngineScripting Engine Version
JavaScriptECMAScript 15 (2024)GraalJSGraalVM 24.1.2
Python 33.11.7GraalPyGraalVM 24.1.2
Python 2.72.7org.python.jython » jython-standalone2.7.2
DMN1.3org.camunda.bpm.dmn » camunda-engine-dmn7.20.0
MVEL2org.mvel » mvel22.5.2.Final
Groovy3.0.21org.codehaus.groovy » groovy-jsr2233.0.21

Looking ahead: Python 2.7 support will be deprecated in FlowX.AI 5.0. We recommend migrating your Python scripts to Python 3 to take advantage of improved performance and modern language features.

By default, FlowX.AI uses Python 2.7 (Jython) for script execution. Python 3 support is available but must be explicitly enabled. See Configuring script engine example for more details.

Integration designer scripting

Scripting LanguageLanguage VersionScripting EngineScripting Engine Version
JavaScriptECMAScript 15 (2024)GraalJSGraalVM 24.1.2
Python3.11.7GraalPyGraalVM 24.1.2

JavaScript

New in v4.7.1: JavaScript support has been upgraded from Nashorn (ECMAScript 5.1) to GraalJS (ECMAScript 15/2024), providing significantly improved performance and modern language features.

JavaScript in FlowX.AI is powered by GraalJS, which supports ECMAScript 15 (2024) standards. This provides modern JavaScript capabilities for your business rules and integrations.

What is GraalJS?

GraalJS is an ECMAScript compliant JavaScript implementation built on GraalVM. It supports the latest ECMAScript features and offers high performance through the GraalVM’s JIT compiler.

Properties

  • Supports ECMAScript 15 (2024) features including modern syntax and APIs
  • Provides consistent scripting across business rules and integration designer
  • Runs in a secure sandboxed environment

Limitations

JavaScript scripts run in a sandboxed environment. Here is a list of JavaScript features not available in the sandbox:

  • import.meta (ES2020)
  • top-level await (ES2022)
  • set operations (ES2024)
  • Array.fromAsync (ES2024)

GraalJS Documentation

ECMAScript 2024 Language Specification


Python 3

Important Configuration Note: Python 2.7 (Jython) is the default Python runtime in FlowX.AI. To enable Python 3 via GraalPy, you must set the feature toggle FLOWX_SCRIPTENGINE_USEGRAALVM to true in the Process Engine configuration and in the AI Developer agent configuration. If this configuration variable is missing or set to false, Python 2.7 will be used.

Python is a high-level, interpreted programming language known for its simplicity and readability. FlowX.AI uses Python 3.11.7 via GraalPy for executing Python scripts.

What is GraalPy?

GraalPy is an implementation of Python that runs on the GraalVM. It offers high compatibility with standard Python (CPython) while providing the ability to run within the Java ecosystem. GraalPy supports Python 3 and provides access to a large subset of the standard Python library.

Properties

  • Supports Python 3.11.7 with access to most common Python libraries
  • Runs up to 3x faster than Python 2.7 via Jython
  • Runs in a sandboxed environment for better security

Python Library Support

Python 3 support in FlowX comes with a subset of the standard Python library. Python runs in a sandboxed environment and the following modules are not available:

“stringprep”, “sqlite3”, “plistlib”, “getpass”, “curses”, “curses.textpad”, “curses.ascii”, “curses.panel”, “xml.parsers.expat”, “xmlrpc.client”, “xmlrpc.server”, “turtle”, “tkinter”, “test.support”, “symtable”, “pyclbr”, “msvcrt”, “winreg”, “winsound”, “grp”, “termios”, “tty”, “pty”, “syslog”, “audioop”, “msilib”, “nis”, “ossaudiodev”, “smtpd”, “spwd”, “crypt”

Available modules might provide limited access to system resources due to the execution in a sandbox environment.

Python 3.11 Documentation

GraalPy Documentation


Python 2.7

Python 2.7 is the default runtime in FlowX.AI 4.7.1 and is implemented via Jython. While it remains fully supported in this version, we recommend migrating to Python 3 for all new development to prepare for future releases.

Jython is an implementation of the high-level, dynamic, object-oriented language Python seamlessly integrated with the Java platform. Jython is an open-source solution.

Jython Book

Properties

  • Supports Python 2.7 most common python libs can be imported, ex: math, time, etc.
  • Java libs can also be imported: details here

Python 2.7 documentation

Jython

Jython FAQs


DMN

Decision Model and Notation (DMN) is a standard for Business Decision Management.

FlowX.AI uses BPMN.io (based on camunda-engine-dmn version 7.20.0) which is built on DMN 1.3 standards.

Properties

camunda-engine-dmn supports DMN 1.3, including Decision Tables, Decision Literal Expressions, Decision Requirements Graphs, and the Friendly Enough Expression Language (FEEL)

Decision Model and Notation (DMN)

DMN 1.3 specs

More information:

DMN Business rule action


MVEL

MVEL is a powerful expression language for Java-based applications. It provides a plethora of features and is suited for everything from the smallest property binding and extraction, to full-blown scripts.

Mvel documentation

Maven repository: Mvel 2.5.2 Final

More information

Intro to MVEL


Groovy

Groovy is a multi-faceted language for the Java platform. The language can be used to combine Java modules, extend existing Java applications and write new applications

We use and recommend Groovy 3.0.21 version, using groovy-jsr223 engine.

Groovy has multiple ways of integrating with Java, some of which provide richer options than available with JSR-223 (e.g. greater configurability and more security control). JSR-223 is recommended when you need to keep the choice of language used flexible and you don’t require integration mechanisms not supported by JSR-223.

JSR-223 (spec) is a standard scripting API for Java Virtual Machine (JVM) languages . The JVM languages provide varying levels of support for the JSR-223 API and interoperability with the Java runtime.

Groovy Language Documentation

[Java] Class GroovyScriptEngineImpl

groovy-jsr223