Building ruleflow models
Ruleflow models allow you to implement your decision logic with rules, and control the flow execution of these rules in a ruleflow.
When you create a ruleflow model, you start with a root folder and a default ruleflow. From there, you can start creating the artifacts that you need to define your decision.
Creating ruleflow artifacts
To create artifacts:
- From your ruleflow model, open the Artifacts tab.
- Select the artifact that you want to create from the artifact toolbar:
The following artifacts are available:
Folder
A folder in a ruleflow model is similar to a folder in a file system. A ruleflow model contains a root folder where all
your artifacts are created by default. You can create other folders at the root level to better organize your artifacts.
A folder can contain multiple subfolders.
Two options are available to add artifacts to a folder:
- Move or copy an existing artifact by clicking the overflow menu
next to its name and selecting Move or copy.
- Create an artifact directly inside the folder by opening the folder and clicking the Add to folder button.
Ruleflow
A ruleflow manages the flow of rule execution within your ruleflow model. A ruleflow model must contain at least
one ruleflow, but can contain more. For more information about ruleflows, see Editing ruleflows.
Decision table
A decision table comprise rows and columns, and each row corresponds to a rule. They present all
possible situations that a business decision might find in a tabular form, and specify which action to take in each of these situations. For more information about decision tables, see Authoring the decision logic.
Business rule
A business rule defines the specific actions to take when certain conditions are met. A basic rule
uses an if-then statement to associate a condition (if) with an action (then). For more information about business rules, see Authoring the decision logic.
Variable set
A variable set contains a set of variables that can be referenced in all the rules and decision
tables in the ruleflow model. These variables can also be used as input and output parameters when you create a function for the ruleflow model.
Each variable in a variable set has the following associated information:
- A name to identify it.
- A type to specify the type of data it can contain. This type can be built-in or custom.
- An initial value.
- A verbalization to define how the variable is referenced in business rules and decision tables.
Only variables that are defined in the ruleset, which are contained in the root package, can be used as input/output parameters for functions. The variables that are defined in variable sets from nested packages can be used only in rules and ruleflows.
For more information about data types and verbalization, see Modeling data.
Editing ruleflows
To edit a ruleflow:
- Select the ruleflow in the Artifacts pane. The ruleflow opens in preview mode.
- Click Open ruleflow button. The ruleflow editor opens. The ruleflow editor helps you create and arrange ruleflow elements. The drag-and-drop feature allows you to easily draw transitions from element to element.
The following diagram shows the main elements of a ruleflow:

Start (1) and end (2) nodes
A start node and an end node are graphical markers for the start and end of a ruleflow. Every ruleflow has one start node and at least one end node.
You can specify actions to be run at the start and end nodes. For example, you can define an action on the start node to reset the data used in the ruleflow. Actions that are defined for an end node also apply to any other end nodes in the ruleflow.
Task nodes (3)
Between the start node and the end node, a ruleflow is made of task nodes that are linked by transitions. The task nodes contain the instructions for what to execute and in what order.
The following types of task node are available:
Rule task node
A rule task node contains a set of business rules and decision tables to be run at that point in the ruleflow.
Depending on how the execution properties of a rule task are set, the rules might execute in order, or following a more complex logic.
Action task node
An action task node contains an action statement to be run. You define the actions of an action task in
the same way that you define actions in business rules.
Function task node
A function task node references another model. The referenced model can be any task model, decision
model, or predictive model contained in the project.
Subflow task node
A subflow task node references another ruleflow to be run. The referenced ruleflow can be any other
ruleflow in the task model.
Transitions (4)
Transitions connect task nodes in a ruleflow and define the sequence of the ruleflow from one task node to another. Transitions are unidirectional and can have associated conditions. These conditions determine whether a transition is part of the execution flow.
Two types of elements can be added to a ruleflow to organize transitions: branches and forks. Branches allow you to organize conditional transitions, in the same way that you can start several conditional transitions from a task node. Forks allow you to create multiple, parallel paths in your ruleflow, if you need to run rules simultaneously.
Creating functions
In a function, you define:
- A reference to a ruleflow, which is going to be used as an entry point to run the ruleflow model. If a ruleflow model contains multiple ruleflows, you can create several functions.
- The input and output parameters that are needed to run the ruleflow model. You create parameters from any of the variables that are available in the ruleflow model.
You need to create functions to:
- Call a ruleflow model from another one.
- Create an operation before publishing your project.
To create a function:
- From your ruleflow model, open the Functions tab.
- Click the + button next to Functions.
- (Optional) Click the default name of the function to edit it.
- Select the ruleflow that you want to use as an entry point to the ruleflow model.
- Define the input and output parameters for the function:
-
Click Add in the Parameters section.
-
Select the variable set that contains the variables you want to use as parameters in the left pane.
-
Select the variables in the right pane, and set the direction of each parameter.
The parameters can have three directions:
IN The parameter value is provided as input to the ruleflow.
OUT The parameter value is provided as output from the ruleflow when you run it.
IN and OUT The parameter value is provided as input to the ruleflow and its value can be modified by the ruleflow and provided as output when you run it.
-
Click Done.
-
Using generative AI in ruleflow models
To use a generative AI skill in your ruleflow model:
- In the Dependencies tab, click Add, and select the generative AI skill that you want to use.
- Open the Artifacts tab, and define the following items:
-
Click Add variable set to add variables.
-
Create functions. See Creating functions.
-
Click Add business rule to add business rules.
For example:
then set 'my output variable 1' to generated_text of the GenAI skill computed from my GenAI variable being 'my input variable' ;
then set 'my output variable 2' to generated_token_count of the GenAI skill computed from my GenAI variable being 'my input variable' ;
then print error_code of the GenAI skill computed from my GenAI variable being 'my input variable' ;
then print error_message of the GenAI skill computed from my GenAI variable being 'my input variable' ;
In these examples, the following items are used:
- Expression:
<gen_ai_skill> computed from <variable> being
- Generative AI skill name:
GenAI skill
- Variable used in the generative AI skill:
my GenAI variable
- Variable (type string) defined in the variable set and set as an input parameter in the function for the ruleflow:
my input variable
- Variable (type string) defined in the variable set and set as an output parameter in the function for the ruleflow:
my output variable 1
- Variable (type integer) defined in the variable set and set as an output parameter in the function for the ruleflow:
my output variable 2
- Expression:
-
Click the Open ruleflow button in your ruleflow, and select the rule task node that you want to add your business rule to. In the Logic pane, click Select artifacts, and select the business rule that you created.
-
What to do next
You can preview your ruleflow model to make sure that it works as expected.
When you're finished building your ruleflow model, you can:
- Click the icon
to make your skill public. Only public skills can be published to the skill catalog.
- Share your changes to make them available to your collaborators.
Parent topic: