Skip to main content

What are Devices?

Devices are physical hardware — sensors, scanners, displays, controllers — that connect directly to your AI agent over the internet. When a device connects, it tells the agent what commands it supports. Those commands instantly become tools the agent can use. No compile, no push, no middleware.

Think of it as:

A remote control for your agent to reach into the physical world — send commands to hardware, receive sensor data back, all in real time

How It Works

1

Device connects

A device client (Node.js or MicroPython) opens a persistent connection to the Lua gateway and declares its capabilities.
2

Agent gets tools

Each device command becomes a tool the agent can call, just like skill tools.
3

Bidirectional communication

The agent sends commands to devices. Devices fire triggers back to the agent. Both directions are instant.

Key Features

Self-Describing

Devices declare their commands at connect time. No server-side schema to maintain.

Two Transports

Socket.IO for Node.js devices. MQTT for microcontrollers and constrained hardware.

Triggers

Devices push events to the agent (e.g., “temperature exceeded threshold”) with server-side handler logic.

Runs on Pico W

The MicroPython client fits on a Raspberry Pi Pico W with 264KB of RAM.

Quick Example

import { DeviceClient } from '@lua-ai/device-client';

const device = new DeviceClient({
  agentId: 'your-agent-id',
  apiKey: 'your-api-key',
  deviceName: 'temp-sensor',
  commands: [
    { name: 'read_temperature', description: 'Read current temperature in celsius' },
  ],
});

device.onCommand('read_temperature', async () => {
  return { temperature: 22.5, unit: 'celsius' };
});

await device.connect();
The agent can now say: “The temperature is 22.5 degrees celsius” when a user asks.

Learn More

Devices Overview

Full introduction to the Device Gateway

5-Minute Quickstart

Connect your first device

Node.js Client

Complete Node.js device client reference

MicroPython Client

Run on a Raspberry Pi Pico W

Examples

Full working examples across industries

Architecture

How commands and triggers flow through the system