PLC + ASI Biont: Connect Any PLC to an AI Agent with Modbus and OPC-UA
PLCs are the silent backbone of industrial automation. They control conveyors, robots, and entire production lines — but most of the data they collect stays unused. ASI Biont is an AI agent that connects directly to your PLC through a chat dialog: you describe the device, and the agent reads registers, analyzes trends, and alerts you to abnormal behavior. No SCADA middleware, no custom drivers, no waiting for a vendor update.
In this practical guide, we show how to connect any PLC to ASI Biont via Modbus/TCP or OPC-UA, how the AI agent writes its own integration code, and what automation scenarios this unlocks.
Why connect a PLC to an AI agent?
A mid-sized PLC can monitor thousands of signals — temperatures, pressures, currents, cycle times. Most are only used inside the control logic. An AI agent can continuously poll the interesting registers, compare readings over time, detect early signs of wear, and explain the situation in plain English. For example, instead of seeing register 40019 = 87, you get: "Motor temperature is rising 4 °C per hour; check cooling." This turns raw data into decisions.
ASI Biont supports the most common industrial protocols out of the box, as shown in the table below.
Connection methods and protocols
| Protocol | Library used by ASI Biont | Typical usage |
|---|---|---|
| Modbus/TCP | pymodbus | Most Ethernet-capable PLCs |
| Modbus RTU | pymodbus + Hardware Bridge | RS-485/RS-232 legacy PLCs |
| OPC-UA | opcua-asyncio | Modern PLCs and edge gateways |
| Siemens S7 | snap7 | Siemens S7-1200/1500/300/400 |
| EtherNet/IP | pycomm3 | Allen-Bradley, Rockwell |
| BACnet | bac0 | Building automation |
| CAN bus | python-can | Embedded industrial controllers |
| MQTT | paho-mqtt | IoT gateways and smart sensors |
| HTTP API / WebSocket | aiohttp | REST / WS interfaces |
| Custom | execute_python | Anything with a TCP/UDP socket |
The agent chooses the method automatically based on what you write. If you say "the PLC is a Modbus/TCP server at 192.168.1.50", the agent will use pymodbus. If it's an OPC-UA server, it will use opcua-asyncio.
The universal approach: execute_python
Unlike platforms that require you to wait for a dedicated "PLC module", ASI Biont can connect to any device through execute_python. The AI agent writes a Python script for your exact hardware and runs it in a 30-second sandbox. You simply describe, in chat, the device type, address, port, baud rate, and register map. The AI generates the script and executes it.
This means you can integrate a custom PLC with a proprietary register map or even a device without a documented protocol — as long as you can describe the network interaction. The AI uses libraries like pymodbus, opcua-asyncio, pyserial, paramiko, paho-mqtt, and aiohttp.
Practical example 1 — Modbus/TCP register read
The most common scenario is reading a holding register. In chat, you type:
"Read holding register 40001 from 192.168.1.50:502 and warn me if it exceeds 80."
ASI Biont will generate and run code similar to this:
from pymodbus.client import ModbusTcpClient
client = ModbusTcpClient('192.168.1.50', port=502)
client.connect()
result = client.read_holding_registers(40001, 1, unit=1)
if not result.isError():
temp = result.registers[0]
if temp > 80:
print(f'ALARM: temperature = {temp}')
else:
print(f'OK: temperature = {temp}')
client.close()
This is the exact code the agent can write and execute in seconds. For periodic monitoring, the script can be scheduled; there is no need for a while True loop.
Practical example 2 — OPC-UA
OPC-UA is the standard for cross-vendor industrial communication. A PLC with an OPC-UA server can be read with a short script:
from opcua import Client
client = Client('opc.tcp://192.168.1.50:4840')
client.connect()
vibration = client.get_node('ns=2;i=10').get_value()
print(f'Vibration: {vibration} mm/s')
client.disconnect()
The agent can also browse the node tree to find the right variable — just ask it to "read the vibration value from the PLC".
Practical example 3 — Legacy PLC over RS-485
If your PLC uses Modbus RTU on a serial port, the connection goes through the ASI Biont Hardware Bridge. You download bridge.py from the ASI Biont dashboard (not from GitHub) and start it locally:
python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 115200 --rate=10
Then the AI agent sends Modbus RTU commands to the PLC through the bridge using industrial_command():
result = industrial_command(
protocol='modbus_rtu',
command='read_holding_registers',
device='plc_line_1',
address=40001,
count=1,
unit=1
)
The bridge has no HTTP API — industrial_command is the correct way to communicate with serial devices.
Real-world use case: predictive maintenance
A maintenance engineer at a packaging plant noticed recurring failures in a conveyor motor. Instead of writing a full SCADA system, they opened ASI Biont and wrote:
"Monitor the motor current (register 40020) and bearing temperature (register 40021) on the PLC at 192.168.2.10 via Modbus/TCP. Compare to the moving average and alert me if the current rises 15% above it."
The agent connected to the PLC, read the registers, calculated the baseline, and created an alert. Three days later, the agent caught a slowly rising current and suggested a bearing inspection — the bearing was defective. The team fixed it during a scheduled shift change, avoiding an unscheduled stop.
Important operational considerations
execute_pythonhas a 30-second timeout. Scripts that need continuous polling should be scheduled or use the platform's event triggers instead of infinite loops.- Always test the connection parameters in the chat first; the AI agent will iterate until the script works.
- For security, isolate the PLC network from the internet; if cloud access is needed, use a bridge or a secure gateway.
Sources and further reading
- Modbus specification and official documents: modbus.org/specs.php
- OPC UA specification: opcfoundation.org
- pymodbus library documentation: pymodbus.readthedocs.io
- Asyncua (opcua-asyncio) documentation: asyncua.readthedocs.io
- snap7 for Siemens communication: snap7.sourceforge.net
- pycomm3 for EtherNet/IP: pycomm3.readthedocs.io
Try it on asibiont.com
The fastest way to see this in action: open asibiont.com, create a chat with the AI agent, and describe your PLC — brand, protocol, IP address, and the register you want to monitor. The AI agent will write the integration code, connect to your device, and start analyzing within seconds. No dashboards, no "add device" buttons — just a conversation.
Comments