Scripts, components and runs
Create and version scripts, start one-off runs from the library, set up components with default inputs and bindings, and follow and stop runs.
Basic concepts#
LooT can process values automatically. Four terms matter:
| Term | Meaning |
|---|---|
| Library entry | A building block with named inputs and outputs (ports). The library holds the system-wide entries and the entries of your tenant's scripts, which appear as Skript/<Name>. An entry has a version and a mode: Job (runs once and ends) or Reactive (runs until stopped and processes arriving values). |
| Script | A program in Python or TypeScript that you store in a tenant. Every change creates a new, immutable version. Each version is a library entry of its own. |
| Component | A tenant object made from a library entry: with default inputs, bindings of ports to nodes, and its own permissions. You start and stop it. |
| Run | One execution. A one-off run starts from a library entry (loot library run), a component run from a component (loot component start). Every run has a number, the run id. |
A run has one of the states OK, IDLE, BUSY or ERROR; a stopped or finished run is IDLE. A component shows the state of its latest run; before the first start loot shows nie gestartet (never started).
Using scripts and components in the web interface is described in Scripts and Components.
| Command | Purpose |
|---|---|
loot script list, loot script show, loot script versions | List scripts, show a script or its versions |
loot script create, loot script update, loot script delete | Create, save a new version, delete |
loot library list, loot library run | Show the library, start a one-off run |
loot component list, loot component get, loot component runs | List components, show one, show its runs |
loot component create, loot component delete | Create a component, delete it |
loot component bind, loot component unbind | Bind a port to a node, remove the binding |
loot component start, loot component stop | Start a run, stop the active run |
loot component set-version | Switch to another version of the same library entry |
loot run get, loot run stop | Show or stop a single run |
Where a command takes a script or component, you give its id or, together with --tenant, its name (case does not matter). A number is always read as an id. Permissions: reading needs Read, saving needs Write, deleting and binding need Manage, starting and stopping need Execute on the object. Creating needs the permission to create scripts or components on the tenant. How to grant permissions is described in Permissions.
Script file format#
loot script create and loot script update read the source from a file in UTF-8. The file starts with a header of comment lines that describes mode and ports. The server reads the header without running the script. Comment character: # in Python, // in TypeScript.
| Header line | Meaning |
|---|---|
loot:mode <job|reactive> | Required, once. job runs once; reactive follows input values until stopped. |
loot:description <text> | Description (once) |
loot:input <name> <type> [required] [nullable] [default=<json>] [-- description] | Input. Types: float, integer, bool, string, dynamic. required and default exclude each other. |
loot:output <name> <type> [nullable] [-- description] | Output |
loot:max-duration <seconds> | Deadline of a run (1 second to 30 days) |
The header ends with the first line of code. A script in Python:
# loot:mode reactive
# loot:input value float required nullable -- Measured value
# loot:input threshold float default=10
# loot:output alarm bool nullable
def run(ctx):
for item in ctx.inputs.follow("value"):
if item.value is None:
ctx.outputs.write("alarm", None, item.timestamp)
else:
ctx.outputs.write("alarm", item.value >= ctx.inputs.get("threshold"), item.timestamp)The server refuses invalid headers and names the line. The source may be at most 256 KiB. How to write scripts and how the script editor of the workbench works is described in Scripts.
Version numbers. The first version is 1.0.0. On every save with changed source the server assigns the next number: only the source changed means a new patch version (1.0.1); a new optional input, a new output or another default value means a new minor version (1.1.0); a removed port, a changed type, a changed mode or a new required input means a new major version (2.0.0). A save without changes keeps the latest version. The language of a script never changes.
loot script list#
Lists the scripts of a tenant for which you have the Read permission.
loot script list --tenant <tenant> [--json]| Option | Meaning |
|---|---|
--tenant <tenant> | Required. Name or id of the tenant |
--json | Print the scripts as JSON |
$ loot script list --tenant Brewery
Id Name Sprache Modus Version Rechte Geändert
-- --------- ------- -------- ------- ------ --------------------------------
7 Threshold python Reactive 1.2.0 Manage 2026-11-28T09:14:02.000000+01:00
8 Average python Reactive 1.0.0 Write 2026-11-20T16:40:51.000000+01:00The Rechte column shows your highest permission on the script: Read, Write or Manage.
loot script show#
Shows a script with its latest version, its ports and, on request, the source.
loot script show <script> [--tenant <tenant>] [--version <version>] [--source] [--json]| Argument or option | Meaning |
|---|---|
<script> | Id of the script or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant. Required when you give the script by name. |
--version <version> | Show a particular version (for example 1.0.0) instead of the latest. loot script versions lists the versions. |
--source | Also print the source |
--json | Print the shown version with its source as JSON (the source is always included) |
$ loot script show Threshold --tenant Brewery
Skript 7: Threshold (python, Reactive)
Version: 1.2.0 (Hash 4f9a1c07b2de, 412 Bytes, 2026-11-28T09:14:02.000000+01:00)
Rechte: Manage
Katalogeintrag: 31 (Skript/Threshold 1.2.0)
Beschreibung: Alarm when a value exceeds the threshold
Port Richtung Typ Optionen
--------- -------- ----- ---------------------------
value Eingang float Pflicht, nullable
threshold Eingang float Standard 10
alarm Ausgang bool nullableThe source is only visible to you if you have the Read permission on the script. The number after Katalogeintrag is the id of the library entry that belongs to this version.
loot script create#
Creates a script with version 1.0.0. Needs the permission to create scripts on the tenant.
loot script create --tenant <tenant> --name <name> --file <file> [--language <language>]| Option | Meaning |
|---|---|
--tenant <tenant> | Required. Name or id of the tenant |
--name <name> | Required. Name of the script. Unique within the tenant (case does not matter) and never changes. |
--file <file> | Required. File with the source, including the header (see above) |
--language <language> | python or typescript. Without it the file extension decides (.py, .ts), otherwise python. |
$ loot script create --tenant Brewery --name Threshold --file threshold.py
Skript 7 angelegt: Threshold (Version 1.0.0)loot script update#
Saves a new source as a new version of the script. Needs the Write permission on the script.
loot script update <script> [--tenant <tenant>] --file <file> [--expected-version <version>]| Argument or option | Meaning |
|---|---|
<script> | Id of the script or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--file <file> | Required. File with the new source |
--expected-version <version> | The version your change is based on. If someone has saved a newer one in the meantime, the server refuses with a conflict message. |
$ loot script update Threshold --tenant Brewery --file threshold.py --expected-version 1.0.0
Skript 7: Threshold, jüngste Version 1.1.0If the source is unchanged, the latest version stays. Use --expected-version in scripts and shared work so you do not overwrite a colleague's change unnoticed.
loot script versions#
Lists the versions of a script, the latest first.
loot script versions <script> [--tenant <tenant>] [--json]| Argument or option | Meaning |
|---|---|
<script> | Id of the script or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--json | Print the versions as JSON |
$ loot script versions Threshold --tenant Brewery
Id Version Hash Bytes Modus Erstellt
-- ------- ------------ ----- -------- --------------------------------
31 1.1.0 4f9a1c07b2de 412 Reactive 2026-11-28T09:14:02.000000+01:00
30 1.0.0 c81e55d0a713 398 Reactive 2026-11-27T13:02:40.000000+01:00loot script delete#
Deletes a script with all its versions. Needs the Manage permission on the script.
loot script delete <script> [--tenant <tenant>]| Argument or option | Meaning |
|---|---|
<script> | Id of the script or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
$ loot script delete Average --tenant Brewery
Skript 8 gelöscht.As long as components still use a version of the script, the server refuses with a conflict message. Delete those components first.
loot library list#
Shows the library: all entries you can set up components from.
loot library listThe command has no options of its own.
$ loot library list
Id Eintrag Version Modus Eingänge Ausgänge
-- ----------------- ------- -------- ----------------------------- ------------
12 Wandler/Skalieren 1.0.0 Job Value:float*, Factor:float Result:float
31 Skript/Threshold 1.1.0 Reactive value:float*, threshold:float alarm:boolPorts are shown as name:type; a * marks a required input. You name an entry by its id or as Classification/Name, optionally with a version: Wandler/Skalieren@1.0.0. Without a version the highest one is taken. The bare name (Threshold) also works if it is unambiguous. Names are matched without regard to case.
loot library run#
Starts a one-off run of a library entry. The command returns at once with the run id, or, with --wait, after the end of the run.
loot library run <entry> --tenant <tenant> [-i <name=value>]… [-o <port=path>]… [--no-log]
[--callback-url <url>] [--retry] [--wait] [--timeout <seconds>]| Argument or option | Meaning |
|---|---|
<entry> | Id of the library entry or Classification/Name[@Version] |
--tenant <tenant> | Required. Name or id of the tenant in which the run is created |
-i, --input <name=value> | Input, repeatable. A number, true/false or a JSON object or JSON string is passed as such, anything else as text. For inputs of type dynamic use JSON. |
-o, --output <port=path> | Output target, repeatable: the values of the output go into the node with this path. The node needs the direction in and you need the Write permission on it. |
--no-log | Do not write a log. Without this option the run keeps a log. |
--callback-url <url> | http or https URL that is called, signed, when the run ends |
--retry | After a container failure, restart with the same inputs on another replica |
--wait | Wait for the end of the run. Exit code 0 only for the end state OK or IDLE. |
--timeout <seconds> | Waiting time for --wait (default 300) |
$ loot library run "Wandler/Skalieren" --tenant Brewery -i Value=21.5 -i Factor=2 -o Result=Brewery/Plant.Line1.Scaled --wait
Lauf 42 gestartet ('loot run get 42').
Lauf 42 beendet: IDLEIf the run ends with ERROR, loot prints Fehler: Lauf 42 endete mit ERROR: … and exits with code 1. The same happens when the waiting time is exceeded.
loot component list#
Lists the components of a tenant that you may read.
loot component list --tenant <tenant> [--json]| Option | Meaning |
|---|---|
--tenant <tenant> | Required. Name or id of the tenant |
--json | Print the components as JSON |
$ loot component list --tenant Brewery
Id Name Eintrag Modus Zustand Bindungen
-- ------------------ ------------------------ -------- ------------- ---------
15 Alarm Line 1 Skript/Threshold 1.1.0 Reactive OK 2
16 Scaling Plant Wandler/Skalieren 1.0.0 Job nie gestartet 1loot component get#
Shows a component with state, default inputs, options, permissions, bindings, latest run and error.
loot component get <component> [--tenant <tenant>] [--log] [--json]| Argument or option | Meaning |
|---|---|
<component> | Id of the component or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--log | Also print the log of the latest run |
--json | Print the component as JSON; with --log the latest run with its log is included |
$ loot component get "Alarm Line 1" --tenant Brewery --log
Komponente 15: Alarm Line 1 (Tenant 3)
Bibliothekseintrag: Skript/Threshold 1.1.0 (Reactive, Id 31)
Zustand: OK
Letzter Lauf 88: gestartet 2026-11-30T08:00:03.000000+01:00 Heartbeat 2026-11-30T14:21:09.000000+01:00 Replikat r1 zugestellt 5230, verworfen 0
Standardeingaben: threshold=80
Optionen: Log ja, Neustart bei Containerausfall nein, Frist der Komponente
Rechte: Manage Execute
Bindungen (2):
Eingang value <- Node 103 (Bindung 21)
Ausgang alarm -> Node 105 (Bindung 22)
Log des Laufs 88 (2):
2026-11-30T08:00:03.000000+01:00 INFO Gestartet
2026-11-30T08:00:04.000000+01:00 INFO Erster Wert verarbeitetBindings name nodes by their id. loot node show resolves a path to the id.
loot component create#
Creates a component from a library entry. Needs the permission to create components on the tenant.
loot component create --tenant <tenant> --name <name> --entry <entry> [-i <name=value>]…
[--log] [--retry] [--max-duration <seconds>]| Option | Meaning |
|---|---|
--tenant <tenant> | Required. Name or id of the tenant |
--name <name> | Required. Name of the component, unique within the tenant |
--entry <entry> | Required. Library entry: id or Classification/Name[@Version] (without a version the highest) |
-i, --input <name=value> | Default input, repeatable. Same value rules as for loot library run. |
--log | The runs of the component write a log |
--retry | After a container failure, restart on another replica |
--max-duration <seconds> | Deadline of a run in seconds (greater than 0). Without it the deadline of the library entry applies. |
$ loot component create --tenant Brewery --name "Alarm Line 1" --entry Skript/Threshold -i threshold=80 --log
Komponente 15 'Alarm Line 1' angelegt ('loot component get 15').A new component has no bindings and has not run yet. Bind its ports next.
loot component bind#
Binds an input or output of a component to a node. Needs the Manage permission on the component.
loot component bind --component <component> [--tenant <tenant>] --port <port> (--input | --output) --node <node>| Option | Meaning |
|---|---|
--component <component> | Required. Id of the component or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--port <port> | Required. Name of the input or output of the library entry |
--input | Bind an input: the values of the node (direction out) flow into the input |
--output | Bind an output: the values of the output go into the node (direction in; you need Write on it) |
--node <node> | Required. Id or path of the node |
Give exactly one of --input and --output; otherwise the command ends with exit code 2.
$ loot component bind --component "Alarm Line 1" --tenant Brewery --port value --input --node Brewery/Plant.Line1.Temperature
Eingang 'value' von Komponente 15 an Node 103 gebunden (Bindung 21).
$ loot component bind --component "Alarm Line 1" --tenant Brewery --port alarm --output --node Brewery/Plant.Line1.Alarm.Active
Ausgang 'alarm' von Komponente 15 an Node 105 gebunden (Bindung 22).loot component unbind#
Removes the binding of a port. Needs the Manage permission on the component.
loot component unbind --component <component> [--tenant <tenant>] --port <port> [--node <node>]| Option | Meaning |
|---|---|
--component <component> | Required. Id of the component or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--port <port> | Required. Name of the input or output |
--node <node> | Id or path of the node. Required only if an output is bound to several nodes. |
$ loot component unbind --component "Alarm Line 1" --tenant Brewery --port alarm
Bindung 22 ('alarm' an Node 105) gelöst.loot component start#
Starts a run of the component. Needs the Execute permission. If a run is already active, the command ends with an error.
loot component start <component> [--tenant <tenant>] [--wait] [--timeout <seconds>]| Argument or option | Meaning |
|---|---|
<component> | Id of the component or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--wait | Wait for the end of the run. Exit code 0 only for OK or IDLE. A reactive component runs until stopped, so --wait makes sense mainly for jobs. |
--timeout <seconds> | Waiting time for --wait (default 300) |
$ loot component start "Alarm Line 1" --tenant Brewery
Komponente 15 gestartet, Lauf 88 ('loot run get 88').loot component stop#
Stops the active run of the component. Needs the Execute permission. The container confirms with IDLE.
loot component stop <component> [--tenant <tenant>] [--wait] [--timeout <seconds>]| Argument or option | Meaning |
|---|---|
<component> | Id of the component or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--wait | Wait for IDLE. Exit code 0 only without ERROR. |
--timeout <seconds> | Waiting time for --wait (default 300) |
$ loot component stop "Alarm Line 1" --tenant Brewery --wait
Stop für Komponente 15 angefordert.
Lauf 88 beendet: IDLEloot component delete#
Deletes a component with its bindings and runs. Needs the Manage permission. Not possible while a run is active; stop it first.
loot component delete <component> [--tenant <tenant>]| Argument or option | Meaning |
|---|---|
<component> | Id of the component or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
$ loot component delete "Scaling Plant" --tenant Brewery
Komponente 16 gelöscht.loot component runs#
Shows the latest runs of a component, the newest first. Needs the Read permission.
loot component runs <component> [--tenant <tenant>] [--limit <count>] [--json]| Argument or option | Meaning |
|---|---|
<component> | Id of the component or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--limit <count> | Maximum number of runs (default 20, must be greater than 0) |
--json | Print the runs as JSON |
$ loot component runs "Alarm Line 1" --tenant Brewery --limit 3
Lauf Zustand Gestartet Beendet Versuch Zugestellt Verworfen Error
---- ------- -------------------------------- -------------------------------- ------- ---------- --------- -----
88 OK 2026-11-30T08:00:03.000000+01:00 - 1 5230 0
85 IDLE 2026-11-29T08:00:02.000000+01:00 2026-11-29T17:30:00.000000+01:00 1 4810 0Zugestellt and Verworfen count the values delivered to the run and the values dropped.
loot component set-version#
Switches a component to another version of the same library entry, also to an older one. Needs the Manage permission. The bindings and default inputs must fit the target version, and no run may be active.
loot component set-version <component> [--tenant <tenant>] --version <version> [--check]| Argument or option | Meaning |
|---|---|
<component> | Id of the component or, with --tenant, its name |
--tenant <tenant> | Name or id of the tenant (required for a name) |
--version <version> | Required. Target version, for example 1.2.0. loot library list shows the versions. |
--check | Only check whether the switch is possible (bindings, default inputs, mode, active run) and change nothing |
$ loot component set-version "Alarm Line 1" --tenant Brewery --version 1.2.0 --check
Komponente 15 'Alarm Line 1': Umstellung von Version 1.1.0 auf 1.2.0 ist verträglich.
$ loot component set-version "Alarm Line 1" --tenant Brewery --version 1.2.0
Komponente 15 'Alarm Line 1' von Version 1.1.0 auf 1.2.0 umgestellt.If the switch is not possible, the check lists every reason and exits with code 1:
$ loot component set-version "Alarm Line 1" --tenant Brewery --version 2.0.0 --check
Komponente 15 'Alarm Line 1': Umstellung von Version 1.1.0 auf 2.0.0 ist nicht möglich:
- <reason from the server>Each reason is one indented line with a dash. Without --check, a switch that is not possible ends with an error and nothing changes.
loot run get#
Shows a single run, whether one-off or of a component.
loot run get <run-id> [--json]| Argument or option | Meaning |
|---|---|
<run-id> | Run id from loot library run or loot component start |
--json | Print the run as JSON, including all outputs |
$ loot run get 42
Lauf 42: Wandler/Skalieren 1.0.0
Zustand: IDLE gestartet 2026-11-30T14:02:11.000000+01:00 beendet 2026-11-30T14:02:12.000000+01:00 Replikat r1
Eingänge: Value=21.5, Factor=2
Ausgänge (1):
2026-11-30T14:02:12.000000+01:00 Result = 43
Log (2):
2026-11-30T14:02:11.000000+01:00 INFO Gestartet
2026-11-30T14:02:12.000000+01:00 INFO FertigThe text form shows the last 20 outputs; a line … nur die letzten 20 von <n> (alle mit --json) points to the rest. Without a log request the line reads Log: nicht angefordert.
loot run stop#
Stops a running run. Needs the Execute permission. The container confirms with IDLE.
loot run stop <run-id> [--wait] [--timeout <seconds>]| Argument or option | Meaning |
|---|---|
<run-id> | Run id from loot library run or loot component start |
--wait | Wait for IDLE. Exit code 0 only without ERROR. |
--timeout <seconds> | Waiting time for --wait (default 300) |
$ loot run stop 88 --wait
Stop für Lauf 88 angefordert.
Lauf 88 beendet: IDLEExample: from script to running component#
- Save the script file with its header, for example
threshold.py, and create the script:loot script create --tenant Brewery --name Threshold --file threshold.py. - Create a component:
loot component create --tenant Brewery --name "Alarm Line 1" --entry Skript/Threshold -i threshold=80 --log. - Bind the ports:
loot component bind … --port value --input --node …andloot component bind … --port alarm --output --node …. - Start it:
loot component start "Alarm Line 1" --tenant Brewery. - Check it:
loot component get "Alarm Line 1" --tenant Brewery --log. - After changing the script (
loot script update …), switch the component to the new version:loot component set-version … --version <new> --check, then without--check. The component stays on its version until you switch it.
For sending commands to devices see Connections, commands and devices; for the data flow into nodes see Data sources.