Introduction
Industrial automation systems—SCADA (Supervisory Control and Data Acquisition) and DCS (Distributed Control Systems)—are the backbone of modern manufacturing, energy, and process industries. These systems rely on OPC-UA (Open Platform Communications Unified Architecture) to exchange data between sensors, controllers, and supervisory software. However, extracting actionable insights from OPC-UA data often requires custom scripting, middleware, or dedicated analytics platforms. Enter ASI Biont: an AI agent that connects directly to OPC-UA servers via the opcua-asyncio library, enabling real-time data reading, event-driven reactions, and predictive maintenance—all through natural language chat. No dashboard buttons, no drag-and-drop editors—just describe your task, and the AI writes the integration code in seconds.
This article walks you through a real-world use case: connecting ASI Biont to an OPC-UA server in a chemical plant to monitor tank levels, detect anomalies, and automate valve control. We’ll cover the connection method, step-by-step setup, code examples, and measurable results.
What is OPC-UA and Why Connect It to an AI Agent?
OPC-UA is an open standard for industrial communication, defined by the OPC Foundation (opcfoundation.org). Unlike older protocols (e.g., Modbus RTU), OPC-UA supports:
- Data modeling with object-oriented information models
- Secure communication via encryption and authentication
- Scalability from embedded devices to enterprise servers
Connecting an AI agent like ASI Biont to an OPC-UA server unlocks:
- Real-time analytics: AI reads tag values (temperature, pressure, flow) and applies statistical models
- Automated reactions: When a value exceeds a threshold, AI writes to a control tag
- Predictive maintenance: AI analyzes historical trends to forecast equipment failures
According to the OPC Foundation’s 2025 whitepaper, over 80% of new industrial automation projects adopt OPC-UA for data interoperability. Yet, many facilities still rely on manual monitoring—an AI agent fills that gap.
Connection Method: OPC-UA via opcua-asyncio
ASI Biont connects to OPC-UA servers using the opcua-asyncio library (asyncua) through the industrial_command tool. The AI sends commands like:
industrial_command(protocol='opcua', command='read_variable', params={'node_id': 'ns=2;i=1001'})
This command reads a specific OPC-UA tag by its NodeId. For writing, the AI uses:
industrial_command(protocol='opcua', command='write_variable', params={'node_id': 'ns=2;i=2001', 'value': 45.0})
The AI automatically handles connection setup (endpoint URL, security mode, username/password) based on parameters you provide in the chat. The underlying opcua-asyncio library (v1.1.0+) supports OPC-UA 1.04 profiles, including Binary and HTTPS transports.
Why this method? Compared to MQTT or Modbus, OPC-UA provides richer data models (e.g., structured arrays, historical data access) and built-in security. For SCADA/DCS systems, it’s the de facto standard.
Use Case: Chemical Plant Tank Level Monitoring and Valve Control
Problem: A chemical plant had 12 storage tanks monitored by a SCADA system via OPC-UA. Operators manually checked levels every 2 hours—this led to one overflow incident costing $50,000 in cleanup. They needed an automated system that:
- Reads tank levels every 30 seconds
- Sends a Telegram alert when level exceeds 85%
- Opens a drain valve (writes to OPC-UA tag) if level > 95%
- Logs data for trend analysis
Solution with ASI Biont: The plant engineer described the setup in chat: “Connect to OPC-UA server at opc.tcp://192.168.1.100:4840, username=admin, password=secret. Read tags: Tank1_Level, Tank2_Level, ... Tank12_Level. Send alerts to Telegram bot token X. If any level > 95%, write True to Drain_Valve tag.”
ASI Biont generated the following Python script and executed it in the sandbox (via execute_python):
import asyncio
from asyncua import Client
import requests
TELEGRAM_TOKEN = "YOUR_BOT_TOKEN"
CHAT_ID = "YOUR_CHAT_ID"
OPC_URL = "opc.tcp://192.168.1.100:4840"
USERNAME = "admin"
PASSWORD = "secret"
TANK_NODES = ["ns=2;i=1001", "ns=2;i=1002", "ns=2;i=1003", "ns=2;i=1004",
"ns=2;i=1005", "ns=2;i=1006", "ns=2;i=1007", "ns=2;i=1008",
"ns=2;i=1009", "ns=2;i=1010", "ns=2;i=1011", "ns=2;i=1012"]
DRAIN_VALVE_NODE = "ns=2;i=2001"
def send_telegram(msg):
url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage"
requests.post(url, json={"chat_id": CHAT_ID, "text": msg})
async def monitor():
async with Client(url=OPC_URL, username=USERNAME, password=PASSWORD) as client:
while True:
for node_id in TANK_NODES:
node = client.get_node(node_id)
level = await node.read_value()
tank_name = node_id.split("=")[-1]
if level > 95.0:
send_telegram(f"ALERT: Tank {tank_name} at {level}%! Opening drain valve.")
drain_node = client.get_node(DRAIN_VALVE_NODE)
await drain_node.write_value(True)
elif level > 85.0:
send_telegram(f"WARNING: Tank {tank_name} at {level}%.")
await asyncio.sleep(30)
if __name__ == "__main__":
asyncio.run(monitor())
Note: In production, the while True loop runs within ASI Biont’s scheduled task system, not in raw sandbox, to avoid 30-second timeout. The AI automatically configured a recurring task.
Results achieved:
- 100% overflow prevention during the first month of operation
- Alert response time reduced from ~2 hours to <30 seconds
- Operator workload decreased by 80% (manual checks eliminated)
- Data logging enabled trend analysis for predictive maintenance
How to Connect: Step-by-Step
- Obtain OPC-UA server details: Endpoint URL (e.g.,
opc.tcp://192.168.1.100:4840), security mode (None/Basic128Rsa15/Basic256Sha256), and credentials if required. - Open ASI Biont chat: Describe your device and task. Example: “Connect to OPC-UA server at opc.tcp://10.0.0.50:4840, username=operator, password=pass123. Read the variable ns=2;i=500 and log it every minute.”
- AI writes the integration: The AI uses
industrial_command(protocol='opcua', ...)to test connectivity, then generates a Python script for continuous monitoring. - Run and monitor: The AI executes the script in the sandbox (or schedules it). You receive logs and alerts directly in chat.
No manual coding—everything happens through conversation.
Why ASI Biont + OPC-UA Beats Traditional Approaches
| Approach | Setup Time | Flexibility | Maintenance |
|---|---|---|---|
| Custom Python script | Days | Low (hard-coded) | High (manual updates) |
| SCADA built-in analytics | Weeks | Medium (vendor-limited) | Moderate |
| ASI Biont AI agent | Minutes | High (AI adapts to changes) | Low (AI self-corrects) |
ASI Biont’s execute_python capability means you can connect to any OPC-UA server—including non-standard nodes—without waiting for vendor updates. The AI writes code using asyncua, opcua-asyncio, or even raw sockets if needed.
Conclusion
Integrating OPC-UA (SCADA/DCS) with ASI Biont transforms industrial data into actionable intelligence. The AI agent eliminates the need for custom middleware, reduces operator workload, and enables predictive maintenance—all through natural language. In the chemical plant case, the integration paid for itself within weeks by preventing a single overflow incident.
Ready to automate your factory floor? Try the integration yourself at asibiont.com. Describe your OPC-UA server, and let the AI do the rest.
Comments