The Key Innovation
Traditional IoT platforms require you to define device capabilities on the server, then write matching firmware, then keep both in sync. With Lua devices, the device itself declares what it can do. There is no server-side schema to maintain.Think of it as:
Each device carries its own resume. When it connects, the agent reads the resume and knows exactly what the device can do.
DeviceCommandDefinition objects. The gateway stores these alongside the connection. The agent runtime reads them and creates tools automatically. When the device disconnects, the tools disappear.
DeviceCommandDefinition Fields
Each command definition has the following fields:The command name. This becomes part of the tool name the agent sees (
device:{deviceName}:{name}). Use lowercase with underscores (e.g., read_temperature, set_brightness).A natural-language description of what the command does. The AI agent reads this to decide when to use the tool. Write it as if explaining to a person: “Read the current room temperature in celsius” is better than “temp read”.
A JSON Schema object describing the parameters the command accepts. The agent uses this to construct the correct payload.
How long to wait for the device to respond before the command fails. Increase for slow operations like printing or scanning.
Automatic retry on failure. The gateway retries with exponential backoff starting at
backoffMs.JSON Schema Examples
No Parameters
Simple Parameters
Enum Parameters
Complex Parameters
Validation Rules
namemust be unique within a single device. Two devices can have commands with the same name.descriptionshould be a complete sentence. The agent treats it as a tool description.inputSchemamust be valid JSON Schema draft-07. Thetypeat the top level should be'object'.timeoutMsminimum is 1000 (1 second). The default of 30000 (30 seconds) works for most commands.
Dynamic Updates
Commands are sent at connect time. To change the command list, update thecommands array in your DeviceClientConfig and restart the device (or disconnect and reconnect).
lua push or lua deploy needed. Just restart the device.
Next Steps
Agent Tools
How device commands become tools the agent can use
Node.js Client
Complete DeviceClientConfig reference
Triggers
The other direction — device events sent to the agent
Quickstart
See self-describing commands in action

