Rulesets
Overview
Rulesets in UPTIQ enable developers to define business rules that can be executed within agentic workflows to automate decision-making. These rules help streamline processes like loan origination, compliance validation, and data filtering based on predefined conditions.
For example, in a loan origination workflow, a ruleset can be used to automatically filter out loan applications where:
The loan amount is less than $1000
The borrower’s age is under 18
By defining these conditions in a Ruleset, the AI agent can evaluate applications instantly and proceed only with the ones that meet the eligibility criteria.
Creating a Ruleset in UPTIQ
Navigate to Config & Utils → Click "Create Ruleset"
Enter a Name for the Ruleset and Save.
Define Facts (Input Variables):
Click on the created Ruleset and select "Create Fact."
Facts are input variables (e.g., loan amount, borrower age) that will receive values dynamically at runtime.
Define Decisions (Rules):
Go to the Decision Tab → Click "Create Decision"
Define a Decision (Rule) by selecting a Fact, setting an operator, and assigning a threshold value.
Example:
Rule Name: Loan Amount should be greater than $1000
Fact: Loan Amount
Operator: Greater than (>)
Value: 1000
Output: Define the variable that will be passed when this rule is met. If the rule is not satisfied, this output variable won’t be included in the Ruleset Node output.
Repeat the same process for borrower age (e.g., Borrower age must be 18 or above).
Click "Add" to create the rule and complete the Ruleset setup.
Using a Ruleset in Workflows
Once a Ruleset is created, it can be integrated into a workflow to dynamically evaluate conditions and automate decision-making. Let’s go step by step with an example.
Example Workflow Scenario
Suppose the previous node in the workflow is a JS Node that processes loan application data and produces the following JSON output:
In UPTIQ workflows, each node’s output serves as the input for the next node. This means the Ruleset Node will receive the above JSON data as input.
Mapping Runtime Values to Ruleset Facts
To enable the Ruleset to evaluate conditions dynamically, we map input variables from the previous node’s output to the corresponding Facts defined in the Ruleset.
Drag a "Ruleset Node" into the workflow
Position it after the JS Node that generates the loan application data.
Select the Created Ruleset
Choose the Ruleset that contains rules for Loan Amount and Borrower Age.
Configure Mappings (Variable Assignments):
Use the special variable
$input
to access the output of the previous node.Assign the runtime values to the respective Facts in the Ruleset:
Ruleset FactMapped ValueLoan Amount
$input.loanAmount
(1500)Borrower Age
$input.borrowerAge
(25)This ensures that when the Ruleset executes, it evaluates Loan Amount = 1500 and Borrower Age = 25 against the pre-defined rules.
Execution & Decision Evaluation
The Ruleset Node evaluates the conditions:
✅ Loan Amount (1500) is greater than $1000 → Rule Passes
✅ Borrower Age (25) is greater than 18 → Rule Passes
If all required conditions are met, the output variables defined in the Ruleset are returned and available for the next workflow node.
What Happens Next?
If both rules pass, the workflow proceeds to the next step, such as approval, document processing, or further validations.
If one or more rules fail, the output variable for that rule will not be included, allowing developers to implement alternative paths, such as rejection or additional review.
Key Takeaways for Developers
✅ Automate Business Logic – Use Rulesets to define and execute structured decision-making processes without manual intervention. ✅ Flexible & Scalable – Define multiple rules within a Ruleset to support complex decision-making in AI workflows. ✅ Real-Time Rule Execution – Pass dynamic runtime values to evaluate conditions in real time. ✅ Seamless Workflow Integration – Easily integrate Ruleset nodes in workflows to automate approvals, filter data, or trigger actions based on rule outcomes.
By leveraging Rulesets, developers can create smarter AI agents that make automated, context-aware decisions, improving efficiency and accuracy across various AI-driven processes.
Last updated