OpenRules Platform

AI & LLM Integration

AI Agent “Inside/Outside Production”

Explore an optimization AI agent that balances internal production and outside purchasing decisions.

AI Agent “Inside/Outside Production” illustration 1

This AI agent helps manufacturers determine the optimal mix of internal production and external sourcing for each demanded product. Each option — whether produced in-house or outsourced — carries an associated cost, and internal production draws on resources with limited capacities. The agent’s core objective is to minimize total production cost while ensuring demand is met exactly or within a specified tolerance.

Here is an example of input data with products, resources, and capacity requirements provided by this DMCommunity’s challenge:

AI Agent “Inside/Outside Production” illustration 11

The agent is powered by the optimization model, which runs in the background on the manufacturer’s server or cloud, and leverages LLMs to guide the manager toward the optimal decision through a plain English dialogue.

The same decision model was also used by OpenRules Decision Playground to achieve the same objective, but through a user-friendly graphical interface that supports a variety of optimization-based decision models.

Decision Service Implementation

We will work with a decision service that allows a production manager to identify optimal combinations of products produced inside, or purchased outside, based on his/her preferences.

You can find the complete decision model in the OpenRules installation – see openrules.solver/AI/InsideOutsideProductionAI. Here is the Glossary:

AI Agent “Inside/Outside Production” illustration 3

We also added an optional table

AI Agent “Inside/Outside Production” illustration 4

The second row of this description directs the underlying Rule Solver instead of the default Solution Method “FindSolution” to use “Minimize Total Weighed Cost”.

OpenRules uses the Glossary and DecisionModelDescription to automatically generate the files “description.md” and “schema.json” that will be passed to an LLM. They make OpenRules-based decision services AI-friendly. The underlying decision model is based on a constraint solver and is described here.

We could use different deployment options. This time, we decided to deploy our decision model as an AWS Lambda function using the standard OpenRules file deployLambda.bat. It returned us this endpoint URL:

AI Agent “Inside/Outside Production” illustration 5

Human-LLM Dialogue

We use the ChatGPT desktop app, which provides a simple graphical interface for managing AI agents. It can be accessed via chatgpt.com by selecting “…More + Codex.” Similar desktop applications are also available from Claude and Gemini.

In the dialogue below, human requests have a gray background and the LLM’s responses have a white background.

AI Agent “Inside/Outside Production” illustration 6
AI Agent “Inside/Outside Production” illustration 7
AI Agent “Inside/Outside Production” illustration 8
AI Agent “Inside/Outside Production” illustration 9
AI Agent “Inside/Outside Production” illustration 10
AI Agent “Inside/Outside Production” illustration 11
AI Agent “Inside/Outside Production” illustration 12
AI Agent “Inside/Outside Production” illustration 13
AI Agent “Inside/Outside Production” illustration 14
AI Agent “Inside/Outside Production” illustration 15
AI Agent “Inside/Outside Production” illustration 16
AI Agent “Inside/Outside Production” illustration 17
AI Agent “Inside/Outside Production” illustration 18
AI Agent “Inside/Outside Production” illustration 19
AI Agent “Inside/Outside Production” illustration 20
AI Agent “Inside/Outside Production” illustration 21
AI Agent “Inside/Outside Production” illustration 22
AI Agent “Inside/Outside Production” illustration 23
AI Agent “Inside/Outside Production” illustration 24
AI Agent “Inside/Outside Production” illustration 25
AI Agent “Inside/Outside Production” illustration 26
AI Agent “Inside/Outside Production” illustration 27
AI Agent “Inside/Outside Production” illustration 28
AI Agent “Inside/Outside Production” illustration 29
AI Agent “Inside/Outside Production” illustration 30
AI Agent “Inside/Outside Production” illustration 31
AI Agent “Inside/Outside Production” illustration 32
AI Agent “Inside/Outside Production” illustration 33
AI Agent “Inside/Outside Production” illustration 34
AI Agent “Inside/Outside Production” illustration 35
AI Agent “Inside/Outside Production” illustration 36
AI Agent “Inside/Outside Production” illustration 37

Conclusion

The LLM had no knowledge of the underlying optimization logic — only the required inputs and outputs. Yet it accurately interpreted input data from an image and made it easy to explore various options in plain English.

Build AI-ready decisions

Connect reliable decision services with the LLM your users prefer.

Start with the free evaluation or request a demonstration of OpenRules AI and MCP integration.