Connect Your First Device
Get a device connected and responding to agent commands.1
Install the device client
2
Configure the credential
For Node.js, create a credential bound to your exact agent, the device name For the Python example, set the variable that its
my-first-device, and the commands operation. Follow Provision a device credential, then save the returned secret in an environment variable:The published Python 1.3.0 client uses
api_key. Set LUA_API_KEY to an existing non-dotted legacy key. Existing legacy configurations remain supported indefinitely.api_key field reads:3
Create a device client
Create a file called Find your
device.ts or device.py. Use the same agent ID and device name that you used at provisioning:agentId in .lua/lua.config.yaml after running lua init, or in the Lua dashboard.4
Register command handlers
Tell the device what to do when the agent sends each command:
5
Connect
6
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

