Skip to main content

LLM connections

The Agent answers questions with a language model (LLM). That model is a plant-local, OpenAI-compatible endpoint, by default Ollama on the same host. You set it with environment variables on the mi-agent service.

Two different things
  • LLM connection (this page): the model the Agent's own chat uses. Set on the mi-agent service. There is no setting for it in the Console UI.
  • AI connections (Settings → AI connections): external assistants such as Claude that connect to the Console over MCP. They bring their own model. See MCP server.

How it works​

The Agent sends the conversation and the plant data it needs to the endpoint you configure. If that endpoint is inside the plant, nothing leaves it. The design is plant-local and works without internet access.

Data leaves the plant if you point it outside

The Agent sends whatever URL you configure. If you set MI_AGENT_LLM_BASE_URL to a cloud service, plant data in the prompts goes there. Egress rules from Governance apply to what the Console returns to the Agent, but they cannot control a model server you choose. Keep the endpoint on the plant network.

Step by step​

  1. Run an OpenAI-compatible server in the plant. With Ollama:

    ollama serve
    ollama pull qwen2.5:3b
  2. Set these variables on the mi-agent service:

    MI_AGENT_LLM_BASE_URL=http://127.0.0.1:11434/v1
    MI_AGENT_LLM_API_KEY=ollama
    MI_AGENT_LLM_MODEL=qwen2.5:3b
    MI_CONSOLE_URL=http://127.0.0.1:8080
  3. Restart mi-agent.

  4. Open Plant → Agent → Chat and ask "How many devices do we have?". Counts and lists are answered by built-in fast paths; ask a question about a value or an alarm to test the model itself.

Settings reference​

VariableDefaultNotes
MI_AGENT_LLM_BASE_URLhttp://127.0.0.1:11434/v1The Agent calls chat/completions under this base URL. Fallback variable: OPENAI_BASE_URL.
MI_AGENT_LLM_API_KEYollamaFallbacks in order: OPENAI_API_KEY, then the file named by MI_AGENT_LLM_API_KEY_FILE. Prefer the file for real keys.
MI_AGENT_LLM_MODELqwen2.5:3bModel name as the server knows it.
MI_CONSOLE_URLhttp://127.0.0.1:8080Console the Agent reads from.
MI_AGENT_LISTEN:8095Listen address.
MI_AGENT_DATA_DIR/var/lib/mi-agentGraph links, proposals, audit.

Timeouts: a model call may take up to 10 minutes, a Console call 45 seconds. One chat turn uses at most 8 tool rounds.

Choosing a model​

The product ships with qwen2.5:3b as the default and tests against it. Beyond that, these are general rules, not measured results for MakeIntelligent:

NeedGuidance
Short lookups and countsA small model is enough; the fast paths do not need a model at all.
Explaining alarms, comparing periods, multi-step questionsUse a larger model. The Agent can call up to 8 tools per question, and small models tend to lose track.
Turkish and EnglishThe chat handles both; choose a model that supports your language well.
HardwareA larger model needs a GPU or plenty of RAM on the model host. Size it before you roll it out; the model host is not part of the MakeIntelligent images.
Tool useThe model must be served through an OpenAI-compatible chat API that supports tool calling. Test with a real question before you rely on it.

Limits and good practice​

  • The model never writes to the plant. Changes become proposals that a person approves. See Approvals and safe write.
  • Whatever the model says, check numbers against See and the unit and quality shown there.
  • Keep the model server on the plant network, bound to a plant address, and do not expose it to the internet.
  • The Agent does not offer a model picker in the UI. Changing the model means changing the variable and restarting the service.

Troubleshooting​

SymptomCauseFix
Chat never answersModel server down or wrong MI_AGENT_LLM_BASE_URL.Open the URL from the mi-agent host; include /v1.
Answers are cut off or emptyModel too small, or the model is still loading.Warm the model or use a larger one.
"Agent service is unavailable"mi-agent not running.Check the service.
401 from the model serverWrong MI_AGENT_LLM_API_KEY.Set the key the server expects.