Agent Tool

Let an AI agent operate the gateway safely

The agent package gives local AI tools a controlled way to inspect status, test configuration, add Modbus devices, rotate agent tokens, and run maintenance actions only with explicit confirmation.

Downloads

Tool

Python CLI for the local gateway API.

Download Tool ZIP

Download gateway_agent_tool.py

Download required gateway_hil_contract.py

Skill

Instructions for AI agents that know how to use skills.

Download Skill ZIP

Download SKILL.md

Download openai.yaml

Download api.md

The other focused reference files live beside it under references/.

What it can do

  • read gateway status and diagnostics;
  • verify authorization mode without exposing secrets;
  • rotate and delete one agent Bearer token;
  • call documented API paths for configuration and Modbus device setup;
  • discover peer gateways through device-side mDNS and prepare .local TCP tunnels;
  • convert, validate, and import SPODES/DLMS models and explicitly switch line ownership;
  • list polling logs and download binary CBOR files safely;
  • upload firmware, reboot, or factory reset only with a matching confirmation flag.

Compatible AI systems

The package is model-agnostic. It works with any AI assistant or agent runner that can use local files, execute a local CLI, or call a local HTTP tool from the operator computer.

  • Works well with coding agents such as Codex, Claude Code, Cursor, Continue, and local agent frameworks.
  • Works with ChatGPT or other hosted models only when a local connector, MCP server, or tool runner gives them access to this CLI or to the gateway API.
  • Does not work from a plain hosted chat window that cannot reach your LAN and cannot run local commands.

Local install

  1. Install Python 3.10 or newer on the operator computer.
  2. Download gateway_agent_tool.py and gateway_hil_contract.py into the same folder.
  3. Make sure the computer can open the gateway web interface, for example http://192.168.1.85.
  4. Rotate an agent token using local admin credentials.
  5. Store the token in the local agent environment, not in source code.
python gateway_agent_tool.py --base-url http://192.168.1.85 --username admin --password admin rotate-token --scopes read,test,configure

set GATEWAY_BASE_URL=http://192.168.1.85
set GATEWAY_AGENT_TOKEN=<token returned once>
python gateway_agent_tool.py status

Skill install

Create a folder named umec-gateway-agent in the skills directory of your AI tool, then preserve the package structure with SKILL.md, agents/openai.yaml, and every references/*.md file.

umec-gateway-agent/
  SKILL.md
  agents/openai.yaml
  references/api.md

Named Tool workflows

TaskCommandVerification
Tunnel peersdiscover-peersHostname, IPv4, ID, and no accidental is_self.
RS-485 ownersfieldbus-linesSaved protocol and runtime owner for each line.
SPODES modelconvert-wb-dlms-template, validate-dlms-template, import-dlms-deviceValidation before write and export/read-back after import.
Protocol switchset-fieldbus-linePreview by default; Apply only with the exact gate and read-back.
Pollingset-line-pollingGET before and after explicit enable/disable.
CBORlist-modbus-logs, download-modbus-logBounded listing, safe relative path, and matching local size.

SPODES/DLMS is read-only in the current release. The Tool does not turn a compatibility command endpoint into permission to write a meter. MQTT threshold and forced interval apply equally to Generic and UMEC.

Safe workflow

  1. Ask the agent to inspect /api/status and /api/auth/session.
  2. Ask it to describe the intended change before sending write requests.
  3. Use tokens without dangerous for normal work.
  4. Use dangerous scope only during a planned maintenance window.
  5. For firmware upload, reboot, or factory reset, require the matching --confirm value.

Examples

python gateway_agent_tool.py session
python gateway_agent_tool.py get /api/modbus/devices
python gateway_agent_tool.py discover-peers
python gateway_agent_tool.py fieldbus-lines
python gateway_agent_tool.py dlms-status --line-id 2
python gateway_agent_tool.py list-modbus-logs --storage auto --path "" --max 500
python gateway_agent_tool.py add-device --json @device.json
python gateway_agent_tool.py upload-firmware firmware.bin --confirm update --timeout 240