Documentation Index
Fetch the complete documentation index at: https://docs.heylua.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Device Definition API gives you two helpers for declaring how your agent talks to a physical or virtual device:defineDevice(config)— declares a device, its commands, and (optionally) its built-in triggers.defineDeviceTrigger(config)— declares a standalone trigger primitive (versioned, pushed independently).
For the device-side client library (the code that runs on the device itself — Node, MQTT, MicroPython), see Device Client and the Devices tab.
defineDevice(config)
Declares a device. Devices have commands (agent → device) and optionally triggers (device → agent).
Configuration — LuaDeviceConfig
Unique device name. Used in
lua devices and addressing from agent code.Human-readable description shown in the admin dashboard.
Optional group label for organizing devices (e.g.
'printers', 'sensors'). lua devices list --group <name> filters by this.Map of command name → command config. Each command is a callable the agent can invoke on the device.
Map of trigger name → trigger config. Built-in triggers tied to this device. For triggers shared across devices, use
defineDeviceTrigger instead.Command Shape — DeviceCommandConfig
What this command does. Used by the agent’s LLM to decide when to invoke.
Zod schema for the command’s input. Validated before the command leaves the agent.
Per-command timeout in milliseconds. Defaults to the device-wide timeout (
30000).Trigger Shape — DeviceTriggerConfig
What this trigger represents. Used in trigger discovery and admin UI.
Zod schema for the trigger payload. Validated when the device fires the trigger.
Handler invoked when the trigger fires. Receives the validated payload and a context with
agent (for invoking the agent) and device (the device that fired).defineDeviceTrigger(config)
Declares a standalone device trigger as a first-class primitive. Use this when a trigger isn’t bound to a single device — for example, a trigger that any device in a group can fire, or a trigger that’s pushed/versioned independently from its associated device.
lua push device-trigger (or as part of lua push all) and managed through the standard CLI surfaces.
Configuration — LuaDeviceTriggerConfig
Unique trigger name. Allowed characters:
a-z, 0-9, _, -. Must start with a letter.What this trigger represents.
Zod schema for the trigger payload.
Handler invoked when the trigger fires.
Wiring Up to an Agent
Invoking Commands from Tools
Inside a skill tool, address a device by name and call its command:Local Testing
Uselua devices test and lua devices test-trigger to exercise commands and triggers without involving real hardware:
Related
- Devices Overview
- Device Client — the device-side library
- Devices Command
- Self-Describing Commands
- Device Triggers

