Skip to content

smartthings-agui 0.1.0

Latest

Choose a tag to compare

@Laptopmini Laptopmini released this 14 Oct 03:06
· 1 commit to main since this release

First release. Talk to a SmartThings home from any AG-UI agent: the SmartThings tools run in the browser, so the token never reaches the agent, and the chat gets device cards and a confirmation step before anything security-sensitive moves.

Not affiliated with or endorsed by Samsung. "SmartThings" is used only to describe what this works with.

npm install smartthings-agui @copilotkit/react-core@1.79.0 @ag-ui/client@1.0.2

npm: https://www.npmjs.com/package/smartthings-agui

What's in it

  • useSmartThingsTools(client): registers SmartThings as CopilotKit frontend tools. Typed tools for switches, dimmers, colour and thermostats (set_switch, set_level, set_color, set_thermostat). execute_command handles the rest of an allowlist (lighting, climate, shades, fans, media), with arguments checked against each capability's definition from the public API. list_devices and get_device_status read the home, and the device and scene list is also sent as agent context.
  • Device and scene cards (show_devices, show_scenes): A2UI v0.9 surfaces built in the browser from live device data. Each icon shows what the device is and its state, and works as its main button; dimmers get a slider. Every card showing a device updates when it changes, whether from the chat or from another card.
  • Safety model: commands for lock, garageDoorControl, doorControl, securitySystem and valve are off by default, and when turned on, each one waits for the person to confirm. A device with any of those capabilities can't be reached through another tool, and scenes always ask first. Card controls go through the same checks. The rules live in one file, policy.ts.
  • Sign-in: a personal access token, or OAuth (beginSignIn / OAuthSession in the browser, with a small token-exchange service in agent/token_exchange.py holding the client secret).
  • Reference agent (Python, FastAPI + the LlamaIndex AG-UI router) and a demo app: npm run dev starts both. The agent has no SmartThings code or credentials and works with any OpenAI-compatible model that supports tool calling.

Tested

@copilotkit/react-core 1.79.0, @ag-ui/client 1.0.2, @copilotkit/a2ui-renderer 1.79.0 (@a2ui/web_core 0.10.4), llama-index-protocols-ag-ui 0.5.0, React 19.3, Node 24.14, Python 3.14.7. Tested against SmartThings virtual devices with a hosted model, including multi-turn conversations, confirmations and refusals. OAuth was tested end to end. Browsers: Chrome, Firefox and WebKit through Playwright, plus Safari on macOS and iPhone by hand. Details: Versions tested.

Not yet verified: local models, real hardware in normal use, Android phones other than in emulation, refresh after a real 24-hour token expiry, and capability versions other than 1 on a real device.

Known upstream issues

The LlamaIndex AG-UI router (0.5.0) has a few bugs that the reference agent works around in agent/router.py: the system prompt repeats on every run, client context is dropped, earlier tool calls are sent to the model as text, and tool parameter types are lost. Tests pin each behaviour, so an upstream fix will show up as a failing test.

Requirements: React 19, a bundler (ES modules only), and the CopilotKit and AG-UI versions above, pinned exactly.