How it works
compose_ui returns A2UI JSON. When custom logic is required, the LLM embeds a __jit__
key holding scripting code inside the same response (no separate code-generation call).
The sandbox
The sandbox runs generated code safely. It is a restricted environment that blocks unauthorized filesystem and network access. Code execution is designed to be fully isolated to protect the host system.Binding output to the UI
A UI component can declare"jit_bind": "key". After the code runs and returns a dict, the
value at that key is bound into the component deterministically. No guessing which output
maps to which widget.
Streaming (live widgets)
For widgets that update continuously, the streaming engine runs a loop that re-executes the code on an interval and pushes updates to the shell:- Drift-free timer: each cycle sleeps just enough so ticks don’t drift.
- JSON diffing: computes the delta each tick and sends only a patch, minimizing payload size.
- Updates are broadcast straight to the shell.
elapsed_time
value (seconds since the stream started), letting the code animate or recompute against a
live clock each tick.