# DecisionRules AI Engine

{% hint style="success" %}
**Production Container**
{% endhint %}

## Introduction

The DecisionRules AI Engine application provides AI-powered support for DecisionRules users and integrations. It accepts requests, routes them to specialized AI services, and returns responses for tasks such as documentation help, rule summaries, decision table design support, function generation, input generation, and UI-related guidance.

Use this service when you want to add AI capabilities to your DecisionRules deployment or expose AI-based workflows to users and connected applications. It exists to keep AI-specific processing separate from the main application runtime while still integrating with the DecisionRules platform.

{% hint style="info" %}
The AI Engine application is optional. It is not required for a standard DecisionRules deployment.
{% endhint %}

The DecisionRules AI Engine application requires:

* access to a [decisionrules-distribution-server](https://docs.decisionrules.io/doc/decisionrules-applications/decisionrules-distribution-server "mention")
* access to a supported AI provider
* enough CPU and memory for the expected AI workload

## Setup

### Where to get it

You can download the latest production image from Docker Hub:

* [DecisionRules AI Engine on Docker Hub](https://hub.docker.com/r/decisionrules/ai-engine)

### Before you start

Install this container only if you need AI-assisted features such as documentation support, rule summaries, decision table design assistance, function generation, input generation, or streamed AI responses.

Before you run the container, make sure you have:

* AI provider credentials configured in the environment or supplied in requests
* a running [client-app](https://docs.decisionrules.io/doc/decisionrules-applications/client-app "mention") or [server-app](https://docs.decisionrules.io/doc/decisionrules-applications/server-app "mention") that will call the AI Engine API

See also:

* &#x20;[#ai-engine](https://docs.decisionrules.io/doc/other-deployment-options/docker-and-on-premise/containers-environmental-variables#ai-engine "mention")
* [decisionrules-distribution-server](https://docs.decisionrules.io/doc/decisionrules-applications/decisionrules-distribution-server "mention")
* [client-app](https://docs.decisionrules.io/doc/decisionrules-applications/client-app "mention")
* [server-app](https://docs.decisionrules.io/doc/decisionrules-applications/server-app "mention")

### Minimal Requirements

* 700MB memory

### Application info

* Default port: 8084

### How to run it

You can run the container directly with `docker run` or through `docker compose`.

**Method 1: Run with `docker run`**

Pull the latest image:

```bash
docker pull decisionrules/ai-engine
```

Run the container:

```bash
docker run -d \
  -p 8084:8084 \
  -e AIA_PROVIDER=openai \
  -e AIA_FAMILY=openai \
  -e AIA_MODEL=gpt-4o-mini \
  -e AIA_SECRET=YOUR_PROVIDER_SECRET \
  decisionrules/ai-engine
```

If every request provides its own AI configuration, the default AI environment variables are optional.

**Method 2: Run with `docker compose`**

Create a `docker-compose.yml` file:

```yaml
version: "1.0"

services:
  ai-engine:
    image: decisionrules/ai-engine
    ports:
      - "8084:8084"
    environment:
      AIA_PROVIDER: openai
      AIA_FAMILY: openai
      AIA_MODEL: gpt-4o-mini
      AIA_SECRET: YOUR_PROVIDER_SECRET
```

Start it with:

```bash
docker compose up
```

#### What to check after startup

After startup, confirm that:

* the AI Engine container is running
* the /health-check endpoint returns a successful response
* the service can reach the configured AI provider
* the service can reach the required [decisionrules-distribution-server](https://docs.decisionrules.io/doc/decisionrules-applications/decisionrules-distribution-server "mention")
* the [client-app](https://docs.decisionrules.io/doc/decisionrules-applications/client-app "mention") or [server-app](https://docs.decisionrules.io/doc/decisionrules-applications/server-app "mention") can successfully call the AI Engine API


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.decisionrules.io/doc/decisionrules-applications/decisionrules-ai-engine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
