Skip to content

Live events and async

Following work as it happens.

live

Live progress: watch() a plan, run or job as it works, the same events the dashboard shows.

Event dataclass

Event(kind: str, topic: str, data: Any, ts: float)

Something that happened while LLMDyno worked.

kind is one of

"run" a run changed state; data is the run summary (id, status, stage, correctness, wall_s, cost_usd, …) "plan" the plan changed state; data has its status "gpu" a GPU telemetry sample while a local model runs (utilisation, VRAM, power, …) "transcript" one agent event in a run's transcript: {"i": index, "ev": event} (watch(..., transcript=True)) "proxy" one model request through LLMDyno's proxy: tokens, cost, latency (watch(..., transcript=True)) "job" a background job's progress: status, progress (0-1), detail "log" one line of a job's log

topic is where it came from (plan:, run:, job:), ts the time it happened.

finished property

finished: bool

A run that reached done / failed / cancelled / skipped, or a plan or job that stopped.

watch

watch(target: Any, *, transcript: bool = False, gpu: bool = True, timeout: float | None = None, poll_s: float = 2.0, _stop: Event | None = None) -> Iterator[Event]

Iterate over what happens to a plan, run or job until it stops:

plan = llmdyno.bench(qwen, "suite_quick", wait=False)
for ev in llmdyno.watch(plan):
    if ev.kind == "run" and ev.finished:
        print(ev.data["benchmark_id"], ev.status, ev.data["correctness"])

Events come live from work running in this process (bench(), review(), downloads, …) and from a remote LLMDyno. Work running elsewhere, such as in a separate web server on this machine, is followed by polling every poll_s seconds (run and plan changes only). transcript=True adds every agent event and model request; gpu=False drops the GPU samples. timeout (seconds) stops waiting early.

aio

Async versions of the library, for asyncio code and notebooks with a running event loop.

from llmdyno import aio

qwen = await aio.local_model("unsloth/Qwen3.8-27B-GGUF", quant="UD-Q3_K_XL")
plan = await aio.bench(qwen, "suite_quick", wait=False)
async for ev in aio.watch(plan):
    print(ev.kind, ev.status)
results = await aio.call(plan.results)

Every public llmdyno function is available here as a coroutine function that runs in a worker thread (asyncio.to_thread), so the event loop stays responsive while a plan runs or a model downloads. The objects they return (Profile, Plan, Results, …) are the normal ones; await aio.call(obj.method, ...) runs any of their methods the same way.

call async

call(fn, *args, **kwargs)

Run any blocking llmdyno call (a function or a method) in a worker thread.

watch async

watch(target, **kwargs)

llmdyno.watch() as an async iterator. Leaving the loop early stops the watcher.