flua for AI agents — every agent-friendly feature in one place

flua is a QuickApp engine: a bundled Lua interpreter with a built-in emulation of an HC3, so QAs run offline on the laptop. This post is the checklist of everything flua offers a coding agent — Copilot, Claude, ChatGPT, DeepSeek, or whatever sits in your editor. Everything below works from a bare pip install fibaro-flua (v0.1.32+), no repo, no controller.

1. Domain knowledge, installed by one command

flua --tool setup scaffolds a QA project with the agent's knowledge base: skills covering the full HC3 REST API reference, QA patterns, testing, and troubleshooting, plus Lua language-server types for QuickApp, fibaro, api and json, plus project instructions (AGENTS.md). The agent then answers from the API reference instead of its training data.

2. The verify loop: the QA is its own test

No pytest, no harness. Assert inside the QA with the built-in library, and the exit code is the verdict:

--%%name:lamp
--%%type:com.fibaro.binarySwitch
--%%u:{button="onBtn",text="On",onReleased="turnOn"}
--%%u:{label="state",text="Off"}
-- --------------- EOH ---------------
local Test = require("flua-test")
local t = Test.new()

function QuickApp:onInit()
  _FLUA.uiEvent("onBtn", "onReleased")     -- press the button, like the HC3 UI
end

function QuickApp:turnOn()
  self:updateProperty("value", true)
  self:updateView("state", "text", "On")
  t:expect(self.properties.value == true, "lamp on")
  local view = self:getView()
  local comps = view["$jason"].body.sections.items[2].components
  t:expect(comps[1].text == "On", "view shows On")
  t:finish()
end
flua --api local --instant lamp.lua
echo $?          # 0 = all assertions held

[lamp5000]: PASS: lamp on
[lamp5000]: PASS: view shows On
[lamp5000]: failures: 0

3. Machine-readable logs

For agents parsing output, --log json emits one JSON object per line — stdout stays pure JSON, flua's own notices go to stderr:

flua --api local --log json lamp.lua

{"time": "2026-10-13T11:15:36", "level": "DEBUG", "tag": "lamp5000", "qaid": 5000, "msg": "PASS: lamp on"}

--logfile run.log appends a copy of the log (ANSI colors stripped) for post-mortems.

4. UI without a browser

QA "lamp" (com.fibaro.binarySwitch)
  button onBtn "On" -> onReleased=turnOn
  label state "Off"

5. The rest of the toolbox

The loop, end to end

A typical agent session: flua --check, edit, run with --api local --instant, read the JSON log and the exit code, fix, repeat — and the controller is never touched until you decide the QA is ready.

flua: https://github.com/jangabrielsson/flua · docs: USAGE.md · tutorial series: see the other threads in this forum section