Connect Your First Device
Get a device connected and responding to agent commands in five steps.1
Install the device client
2
Create a device client
Create a file called
device.ts (or device.py) and configure the client with your agent credentials:Find your
agentId and apiKey in .lua/lua.config.yaml after running lua init, or in the Lua dashboard.3
Register command handlers
Tell the device what to do when the agent sends each command:
4
Connect
5
Test with lua chat
In another terminal, start a chat session with your agent:Try saying:The agent will use the device tools to send commands and return the results.
No compile or push needed. Your device declared its commands at connect time. The agent already has tools for them. Change the commands array, restart the device, and the agent sees the new tools instantly.
Complete Working Example
Here is the full file in one piece:Next Steps
Architecture
Understand how commands and triggers flow through the system
Self-Describing Commands
Learn how devices declare their capabilities
Triggers
Let your device push events to the agent
Node.js Client Reference
Full API reference for the device client

