Slug: rules-engine-model Version: 1.0.0

Overview

Kodexa Rules Engine Model

The Rules Engine model provides a powerful framework for implementing conditional logic in your document processing pipelines. Based on the REET (Rule Evaluation Execution Trigger) algorithm, this model allows you to define rules with conditions and actions that execute when those conditions are met.

How It Works

  1. The engine evaluates a set of prioritized rules against document data
  2. When a rule’s conditions evaluate to true, the associated actions are triggered
  3. Actions can modify document metadata, create tasks, or interact with other systems
  4. Rules are evaluated in order of priority, allowing for complex decision trees

Core Components

Rules

Rules contain conditions and actions. Each rule has:

  • A name and description
  • A priority value (lower numbers execute first)
  • A list of conditions that must all be true for the rule to trigger
  • A list of actions to execute when the rule triggers

Conditions

Conditions are functions that evaluate some aspect of your data and return true or false.

Actions

Actions are executed when a rule’s conditions are met. The model includes several built-in actions:

  • set_value: Sets a property value in the document context
  • run_prompt: Executes an LLM prompt against document content
  • reject_document: Marks a document as rejected with a reason
  • send_to_vs: Forwards document data to Visual Studio Kodexa

Process Flow

Example Rule Structure

rules:
  - name: "Detect Invoice Number Missing"
    description: "Checks if invoice number is missing and flags document"
    priority: 10
    conditions:
      - description: "Check if invoice_number is empty"
        expression: "invoice_number == null || invoice_number == ''"
    actions:
      - type: "set_value"
        description: "Flag missing invoice number"
        parameters:
          property_name: "quality_issue"
          value: "Missing invoice number"
      - type: "reject_document"
        description: "Reject document due to missing invoice number"
        parameters:
          reason: "Missing required invoice number field"

Advanced Usage

The Rules Engine can be extended with custom conditions and actions for complex business logic:

  • Integration with LLM models via the run_prompt action
  • Custom validation rules for specific document types
  • Workflow routing based on document content
  • Quality control gates with automatic rejection of non-compliant documents

By combining different rules with appropriate priorities, you can create sophisticated decision trees that handle complex document processing requirements.


Model Details

  • Provider: Kodexa