Skip to main content

The Agent

The Agent is a separate service (mi-agent) that sits next to the Console in the plant. It gives AI a safe view of your plant in three steps: See live values, Understand how machines relate, and Act by proposing changes that a person must approve. It also offers a chat that uses a plant-local language model, so questions and answers never leave the plant.

Agent page with the See, Understand, Act and Chat tabs
Agent page with the See, Understand, Act and Chat tabs

Open it under Plant → Agent. The page lead reads "Your plant, in a language AI understands — See · Understand · Act."

How it works​

  • The Agent calls the Console with your Console token. Whatever your roles do not allow, the Agent cannot read or propose.
  • The language model is an OpenAI-compatible endpoint inside the plant. By default the Agent expects a local Ollama on the same host.
  • Changes are never executed by the Agent. They become Act proposals that wait in Approvals. See Approvals and safe write.

The three pillars​

PillarWhat it givesWhat you see in the Console
SeeLive values with name, unit, quality and source.Tab See.
UnderstandThe plant graph with the relations contains, feeds, controls and depends_on, plus an impact walk ("What stops if Press stops?").Tab Understand. Add links under "Plant links" with Add link (From, To, Relation).
ActPropose, then a person approves or rejects, then execute, with an audit trail.Tab Act embeds the Approvals panel.

The Agent's context format is named mii.context/v3. You can request a profile of it: see, understand or full.

The chat​

Tab Chat is an isolated conversational operator.

  • It uses the Console token of the person who is chatting. Tools are filtered by that person's role capabilities.
  • Any change it wants to make becomes an Act proposal. The chat states its policy as "Act policy: propose + list only".
  • It shows which tools it used ("Tools used") and your roles ("Your roles").
  • One question can use at most 8 tool rounds.
  • Common questions are answered by built-in fast paths, in English and Turkish: counts and lists of devices, rules, uplinks and runtimes, "my capabilities", live values, impact, and acknowledgements.
note

The chat is only as good as the model behind it. A small model such as the default qwen2.5:3b is fast but weak at multi-step reasoning. See LLM connections for guidance.

Configure the Agent service​

The model is set only through environment variables on the mi-agent service. There is no model setting in the Console UI. (The Console page Settings → AI connections is about external assistants over MCP, not about this model.)

VariableDefaultMeaning
MI_AGENT_LLM_BASE_URLhttp://127.0.0.1:11434/v1OpenAI-compatible base URL. Falls back to OPENAI_BASE_URL.
MI_AGENT_LLM_API_KEYollamaAPI key sent to the model server. Falls back to OPENAI_API_KEY or the file in MI_AGENT_LLM_API_KEY_FILE.
MI_AGENT_LLM_MODELqwen2.5:3bModel name.
MI_CONSOLE_URLhttp://127.0.0.1:8080Console the Agent calls.
MI_AGENT_LISTEN:8095Listen address.
MI_AGENT_DATA_DIR/var/lib/mi-agentStores graph links, proposals and the audit trail. Keep it on persistent storage.
MI_AGENT_PLANT_ID (or MI_PLANT_ID)nonePlant id.
MI_MCP_ALLOW_HITL_EXECUTEfalseSee Approvals and safe write.

Model calls time out after 10 minutes; calls to the Console time out after 45 seconds. If the service is down, the page shows "Agent service is unavailable. Check plant Agent or try again."

Quick local test of the service on a development machine:

ollama serve && ollama pull qwen2.5:3b
export MI_CONSOLE_URL=http://127.0.0.1:8080
export MI_AGENT_LLM_BASE_URL=http://127.0.0.1:11434/v1
export MI_AGENT_LLM_MODEL=qwen2.5:3b
export MI_AGENT_DATA_DIR=/tmp/mi-agent-data

Agent endpoints​

The service answers under /agent/v1/* (also /v1/*) and /agent/health.

Method and pathPurpose
GET /agent/v1/sessionWho you are and what you may do.
GET /agent/v1/context?profile=see|understand|fullContext for AI.
GET /agent/v1/context/profilesAvailable profiles.
GET, POST, DELETE /agent/v1/context/graph/edgesPlant links.
POST /agent/v1/chatChat.
GET /agent/v1/act/proposals, POST /agent/v1/act/proposals/{id}/approve|reject|execute, GET /agent/v1/act/auditProposals and their audit.
GET, POST /agent/v1/mcpA smaller MCP endpoint with 11 tools.
caution

The MCP endpoint of the Agent is a reduced set (values, history, graph, impact, inventory, alarms, mii_meta_whoami). For the full tool catalogue connect to the Console endpoint instead. See MCP server.

What the Agent can and cannot do​

It canIt cannot
Read live values, history, alarms, inventory and the plant graph that your roles allow.Write a tag, acknowledge an alarm or change configuration by itself.
Explain impact ("what depends on this?").Approve, reject or execute its own proposals.
Propose changes with a reason; the proposal waits in Approvals.See data that egress rules withhold.
Answer in English or Turkish.Reach the internet: it needs only the plant-local model and the Console.

Troubleshooting​

SymptomCauseFix
"Agent service is unavailable"mi-agent not running or not reachable through the ingress /agent/v1/*.Check the service and its address.
Chat answers are slow or wrongModel too small, or the model server is cold.Use a larger model or keep it loaded. See LLM connections.
Chat says it cannot do somethingYour role lacks the capability.Ask an administrator. See Users and roles.
Proposals do not runThey wait for a person.Open Approvals.