Skip to content

From analytics to action: Wiring agentic decisions back into the UNS

by Kudzai Manditereza
16 min read

The shift from dashboards to autonomous action is the highest-leverage architectural change a manufacturing data team can make today. If your Unified Namespace already streams contextualized analytics (OEE calculations, SPC outputs, anomaly scores), then the infrastructure for agentic decision-making is closer than you think. The missing piece is not more data; it is a disciplined pattern for wiring agent decisions back into the UNS so that downstream systems, both human and machine, can consume and act on them safely.

This post walks through the architecture, topic design and guardrail patterns for closing the analytics-to-action loop on HiveMQ, aimed at engineers who already operate a production UNS and want to extend it with agentic capabilities.

Why should agents consume UNS analytics instead of dashboards?

A well-built UNS already publishes derived analytics: rolling OEE per line, statistical process control (SPC) violations, energy consumption anomalies, predictive maintenance scores. In most deployments, these topics exist solely for visualization. A Grafana panel consumes site/chicago/line-3/analytics/oee-rolling-15m, a human reads it and maybe a human initiates a corrective action.

The problem is latency, not computational but organizational. The time between an SPC violation appearing on a dashboard and an operator adjusting a setpoint can be minutes to hours, depending on shift staffing, alert fatigue and whether anyone is watching. In high-throughput discrete manufacturing or continuous process environments, that delay translates directly into scrap, energy waste or unplanned downtime.

Agents eliminate the organizational latency. An agent subscribing to site/chicago/line-3/analytics/spc-violation can evaluate the violation against a decision model, determine the appropriate corrective action and publish that action back to the UNS within milliseconds. The key architectural insight is that the agent is not bypassing the UNS; it is a participant in it, consuming and producing topics like any other system.

The difference compounds: fewer defective parts downstream means fewer rework cycles, fewer customer escapes, and tighter process capability indices.

How do you design UNS topics for agent-written decisions?

Topic design is where most teams get this wrong. The temptation is to let agents publish directly to actuator command topics (e.g., site/chicago/line-3/cell-2/plc/setpoint-write). Do not do this. It collapses the decision layer into the actuation layer and makes it impossible to audit, override, or govern agent behavior independently.

Instead, introduce a dedicated decision layer in your topic hierarchy:

site/{site}/line/{line}/agent/{agent-id}/decisions/{decision-type}
site/{site}/line/{line}/agent/{agent-id}/decisions/{decision-type}/status

For example:

site/chicago/line-3/agent/spc-corrector-01/decisions/setpoint-adjustment
site/chicago/line-3/agent/spc-corrector-01/decisions/setpoint-adjustment/status

The decision payload should be a structured envelope, not a raw command. Here is an example schema pattern:

{
  "decisionId": "d-20250615-084532-spc-c01",
  "agentId": "spc-corrector-01",
  "timestamp": "2025-06-15T08:45:32.441Z",
  "triggerTopic": "site/chicago/line-3/analytics/spc-violation",
  "triggerPayload": { "parameter": "torque", "value": 14.7, "ucl": 14.5, "rule": "1-beyond-3sigma" },
  "action": {
    "type": "setpoint-adjustment",
    "target": "site/chicago/line-3/cell-2/plc/torque-setpoint",
    "currentValue": 14.2,
    "proposedValue": 13.8,
    "unit": "Nm",
    "rationale": "Reduce torque setpoint to bring process within 2-sigma band based on last 50 samples"
  },
  "confidence": 0.87,
  "envelope": {
    "maxDelta": 1.0,
    "minValue": 12.0,
    "maxValue": 16.0,
    "requiresApproval": false,
    "ttlSeconds": 300
  },
  "lineage": {
    "modelVersion": "spc-corrector-v2.3.1",
    "trainingDataRange": "2025-01-01/2025-06-01",
    "analyticsSourceTopics": [
      "site/chicago/line-3/analytics/spc-violation",
      "site/chicago/line-3/analytics/oee-rolling-15m"
    ]
  }
}

Notice the envelope field. This is the agent's self-declared constraint boundary: the maximum delta it will ever propose, the absolute min/max values, whether human approval is required, and the time-to-live after which the decision expires unexecuted. This envelope is not just documentation; it is enforceable policy, which brings us to guardrails.

How does HiveMQ Data Hub enforce agent decision guardrails?

The critical architectural requirement is that guardrails live in the data path, not in the agent code. An agent declaring its own constraints is necessary but not sufficient. If the only thing preventing an agent from writing a dangerous setpoint is the agent's own logic, you have a single point of failure. In industrial environments, that is unacceptable.

HiveMQ Data Hub operates as a policy engine within the broker itself, evaluating every message against configurable validation, transformation, and routing rules before it reaches subscribers. For agent decision governance, this means:

Schema validation on decision topics. Every message published to site/+/line/+/agent/+/decisions/# must conform to the decision envelope schema. Messages missing required fields (confidence score, TTL, envelope constraints) are rejected at the broker. The agent never gets to skip the paperwork.

Envelope enforcement. Data Hub policies can validate that the proposedValue falls within the declared minValue/maxValue range, that the delta between currentValue and proposedValue does not exceed maxDelta, and that the confidence score meets a minimum threshold. A policy violation does not just log a warning; it drops the message and publishes a rejection event to an audit topic.

Topic-level write ACLs. The agent's MQTT client credentials grant write access only to its own decision topics site/chicago/line-3/agent/spc-corrector-01/decisions/#). It cannot write to other agents' decision topics, cannot publish directly to PLC command topics, and cannot alter analytics topics. This is standard HiveMQ RBAC configuration, but it becomes critical when agents are in the loop.

Rate limiting. A malfunctioning agent that publishes hundreds of setpoint adjustments per second is a production incident. Data Hub policies can enforce per-topic publish rate limits, throttling or dropping messages that exceed configured thresholds.

Here is a simplified pseudocode representation of a Data Hub policy for agent decisions:

policy:
  id: agent-decision-guardrail
  matching:
    topicFilter: "site/+/line/+/agent/+/decisions/setpoint-adjustment"
  validation:
    schemaId: "agent-decision-envelope-v1"
  rules:
    - condition: "payload.confidence < 0.70"
      action: DROP
      audit: "Low confidence decision rejected"
    - condition: "abs(payload.action.proposedValue - payload.action.currentValue) > payload.envelope.maxDelta"
      action: DROP
      audit: "Proposed change exceeds declared envelope"
    - condition: "payload.action.proposedValue < payload.envelope.minValue OR payload.action.proposedValue > payload.envelope.maxValue"
      action: DROP
      audit: "Proposed value outside absolute bounds"
  onDrop:
    publishTo: "site/${topic.site}/line/${topic.line}/agent/${topic.agentId}/audit/rejected"

Every rejected decision is published to an audit topic, creating a complete record of what the agent tried to do and why it was stopped. This audit trail is not just good practice; for regulated manufacturing (pharmaceutical, automotive, food and beverage), it is a compliance requirement.

How do you close the loop from agentic decision to actuation in the UNS?

With the decision layer in place and guardrails enforced, the final piece is a bridge service that subscribes to validated decision topics and translates them into actuation commands. This is deliberately a separate component from the agent:

[Analytics Topics] → [Agent] → [Decision Topics] → [Data Hub Validation] → [Bridge Service] → [PLC Command Topics]

The bridge service is intentionally simple. It does not contain decision logic. It subscribes to validated decision topics, confirms the TTL has not expired, maps the proposed value to the PLC's expected payload format, and publishes to the actuator command topic. If approval is required requiresApproval: true), the bridge service instead publishes to an approval queue topic and waits for a human operator to confirm via a separate approval topic.

site/{site}/line/{line}/approvals/pending/{decisionId}
site/{site}/line/{line}/approvals/confirmed/{decisionId}
site/{site}/line/{line}/approvals/rejected/{decisionId}

This pattern, separating decision from actuation with a stateless bridge, gives you several properties that matter in production:

  1. Independent scaling. Agents can be deployed, updated, or rolled back without touching the bridge service. Bridge services can be replicated per line or per cell.

  2. Testability. You can run agents in shadow mode, publishing decisions to a parallel topic namespace shadow/site/chicago/...) where they are logged and evaluated but never actuated.

  3. Graceful degradation. If the bridge service goes down, decisions accumulate on their topics (with MQTT retained messages if configured) and can be evaluated when the bridge recovers, subject to TTL expiry.

  4. Multi-agent coordination. Multiple agents can publish decisions to the same decision type topic. A coordination service can subscribe, evaluate conflicting proposals, and select the optimal action before forwarding to the bridge.

What does an end-to-end agentic decision architecture on HiveMQ look like?

For a concrete reference, consider a stamping press line running four cells, each with torque, force, and position sensors streaming at 100 Hz to HiveMQ Edge for protocol translation from Modbus TCP to MQTT. The architecture stacks as follows:

Streaming layer (HiveMQ Broker): Raw sensor data publishes to site/chicago/line-3/cell-{1-4}/sensors/{parameter}. HiveMQ Broker handles clustering across two availability zones, with bridging connecting the plant-floor broker to a cloud replica for historical analytics.

Analytics layer: A Kafka consumer group (connected via HiveMQ's Kafka extension) feeds a Flink pipeline that computes rolling SPC statistics, publishes violations back to site/chicago/line-3/analytics/spc-violation, and maintains OEE aggregates on site/chicago/line-3/analytics/oee-rolling-15m.

Decision layer: An SPC corrector agent subscribes to violation and OEE topics, runs a reinforcement learning model trained on six months of historical correction outcomes, and publishes setpoint adjustment decisions to its decision topic. A predictive maintenance agent subscribes to vibration spectral features and publishes maintenance scheduling decisions.

Governance layer: Data Hub validates every decision against the envelope schema, enforces confidence thresholds (0.70 for setpoint changes, 0.85 for maintenance scheduling), and rate-limits each agent to 10 decisions per minute per cell.

Actuation layer: The bridge service maps validated decisions to PLC write commands via OPC UA, with a 30-second approval window for any decision that proposes a delta exceeding 50% of the declared maxDelta.

In this architecture, every component is independently deployable, every decision is auditable and no single agent failure can result in an unsafe actuation. The UNS remains the single source of truth for what is happening (sensor data), what it means (analytics), what should be done (agent decisions), and what was done (actuation confirmations published back to site/chicago/line-3/cell-{1-4}/actuations/confirmed).

Conclusion

The path from analytics on a dashboard to analytics driving autonomous action is not a framework change; it is a topic design change, a policy configuration change and a deployment pattern change. The UNS already carries the data. HiveMQ Broker and Data Hub already enforce the governance. What remains is the disciplined separation of decision, validation, and actuation into independently governed layers.

Start by picking one analytics output that currently drives a manual operator action and wire an agent to it in shadow mode. Validate for two weeks. Promote to production with a conservative envelope. Expand from there.

Try HiveMQ for free to prototype this pattern, or explore the Data Hub documentation to configure decision governance policies on your existing broker.

Frequently asked questions

Kudzai Manditereza

Kudzai is a tech influencer and electronic engineer based in Germany. As a Senior Industrial Solutions Advocate at HiveMQ, he helps developers and architects adopt MQTT, Unified Namespace (UNS), IIoT solutions, and HiveMQ for their IIoT projects. Kudzai runs a popular YouTube channel focused on IIoT and Smart Manufacturing technologies and he has been recognized as one of the Top 100 global influencers talking about Industry 4.0 online.

  • Kudzai Manditereza on LinkedIn
  • Contact Kudzai Manditereza via e-mail
HiveMQ logo
Review HiveMQ on G2