Decision Intelligence Platform

OpenRules AI Assistant

OpenRules-based decision models deployed as AI Agents can communicate with end users through any major Agentic AI assistant — such as ChatGPT Codex or Claude Code. OpenRules also provides a built-in AI Assistant, which is particularly useful for testing decision models in plain English and simulating various end-user interaction scenarios.

Below we demonstrate how to use the OpenRules AI Assistant with the “Loan Selection” decision model, which helps bank customers find the right loan. We will walk through an actual dialogue between a loan applicant and the decision model, explain how to configure the OpenRules AI Assistant, and present the decision model’s implementation details.

OpenRules AI Assistant Dialogue

A complete working example “LoanAIAssistant” is available in the installation folder “openrules.samples/AI/”. Click on “runAIAssistant.bat” to start OpenRules AI Assistant, already aware of this loan selection decision model. So, you do not need to add any additional information and just say “Hi” to start and run the following dialogue in your browser:

Considering that the LLM has no knowledge of the underlying decision model logic, it does a remarkable job supporting free-form interaction with an end user. In the DecisionProblemDescription, we instructed it to maximize the Integrated Objective. As the dialogue shows, however, a user can easily switch optimization objectives and add additional constraints on the fly.

OpenRules AI Assistant Configuration

The project openrules.samples/AI/LoanAIAssistant provides a complete working example of OpenRules AI Assistant. As with any agentic AI assistant, you need to be a registered user of an LLM tool such as ChatGPT Codex or Claude Code. In this example, we use OpenAI but you can easily switch to Anthropic, Google, or other chat models.

OpenRules AI Assistant is based on the standard Spring AI, which requires defining the file “application.properties” and the environment variable for the selected LLM tool.

Creating file “src/main/resources/application.properties”

You can learn more about these and other application properties at Spring AI.

Defining Spring AI Environment Variables

When you register with your selected LLM tool such as ChatGPT Codex or Claude Code, you receive your secret API key. OpenRules relies on Spring AI, which requires you to save your secret key in the proper environment variable:

  • OPENAI_API_KEY for OpenAI
  • ANTHROPIC_API_KEY for Anthropic.

As for all OpenRules projects, you need to properly define two files “project.properties” and “pom.xml”.

File “project.properties”

This image has an empty alt attribute; its file name is image-21.png

This is a regular text file with OpenRules properties that refer to the locations of the main decision model file and the proper test file. It is important to specify the unique property “mcp=http“.

File “pom.xml”

See openrules.samples/AI/LoanAIAssistant/pom.xml. It includes important additional dependencies:

For OpenRules AI Assistant:

    For Spring AI using OpenAI:

    If you use Anthropic, replace spring-ai-starter-model-openai with spring-ai-starter-model-anthropic.

    You also need to add the following plugin:

    Underlying Decision Model

    This is a very simplified loan model that nevertheless allows a customer to identify optimal combinations of loan amount and repayment term based on their own preferences. You can find the complete decision model in the OpenRules installation – see openrules.samples/AI/Loan.

    Here is the Glossary:

    It defines two unknown decision variables, LoanAmount and LoanTerm, based on the domains (possible values) provided as input arrays.

    Here is an optional table “DecisionModelDescription”:

    This model uses RuleSolver. The predefined RuleSolver’s method “DefineAndSolve” executes these two tables:

    The table “DefineVariables”

    specifies different constrained (unknown) variables. In particular, it defines the “IntegratedObjective” as

    LoanAmount – LoanTerm*10 – MonthlyPayment*10

    The table “PostConstraints” posts the major loan eligibility constraint:

    OpenRules RuleSolver also defines a range of variables — including Solution Method, Solution Objective, Optimization Strategy, and Time Limit — as well as search methods such as FindSolution, Minimize, and Maximize.