Loop Observability
Loop Trace Format (LTF) and OpenTelemetry conventions for production loop monitoring.
SREs need spans for iterations, evaluators, token burn, and LES deltas — not raw chat logs. This repo defines the format and ships loopotel, a minimal Python instrumentation library.
Install
pip install loopotel
pip install "loopotel[loopgym]" # LoopGym episode tracing
pip install "loopotel[otlp]" # OTLP export
Quick start — trace a LoopGym run
import loopgym as lg
from loopotel.integrations.loopgym import run_traced_episode
from loopotel.exporter.jsonl import JsonlExporter
env = lg.make("loopbench/code-repair-v1")
result, trace = run_traced_episode(env, task_id="cr-001", seed=42, enabled=True)
JsonlExporter("traces.jsonl").export(trace)
print(result["success"], trace["trace_id"])
Or run the example:
pip install loopgym loopotel
python examples/export_loopgym_ltf.py
API
from loopotel import LoopTracer, emit_iteration, trace_loop
with LoopTracer(loop_name="my-loop", env_id="prod/agent") as tracer:
emit_iteration(iteration=1, goal_score=0.55, tokens_delta=120,
worker_id="implementer", evaluator_id="rubric")
tracer.finish(outcome="success", termination_reason="goal_met")
trace = tracer.build_trace() # ltf/0.1 document
Specs
| Document | Purpose |
|---|---|
specs/ltf-0.1.schema.json |
LTF JSON schema |
specs/otel-semconv-loop.md |
loop.* OTel attributes |
specs/les-timeseries.md |
Point-in-loop LES metrics |
Grafana
Import examples/grafana-dashboard.json for iteration vs goal score, cumulative LES, and token burn panels (sample data included).
Validate
loopotel-validate examples/sample-trace.jsonl
python scripts/validate_ltf.py path/to/trace.json
Design
- Minimal overhead — tracing off by default; pass
enabled=Truefor SimEnv, usetrace_live_episode()for LiveEnv - Exporters — JSONL (built-in), OTLP (optional), LoopNet trajectory mapping
- Pins —
lss@1.0.0,les@1.0.0,ltf@0.1.0
Links
- LoopNet end-to-end tutorial — HF → replay → LoopBench
- Loop Core Engineering — LES / LSS
- LoopGym — instrumentation target
- LoopNet — trajectory corpus export
- Publishing · PyPI
Release files for loopotel 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| loopotel-0.1.0.tar.gz | 16.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| loopotel-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.8 kB
Release files / loopotel-0.1.0.tar.gz
| Download URL | loopotel-0.1.0.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31b276983c3c538cba6b2b885fc4f1bdb0cc0603a61a51d540b710647b59d05a
|
|
BLAKE2b-256 checksum How to use checksums |
9aa44c2c76cef24ecae5bef4102917b3bfba7d76e4779c4cc6ffd17a9d63e6b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / loopotel-0.1.0-py3-none-any.whl
| Download URL | loopotel-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3843c7f37dc24e3e09412f9b591410b6ccd10924528dcfaa0af7eec50cd92d2
|
|
BLAKE2b-256 checksum How to use checksums |
868d8bfa164687e096e24608e7dcbb8612510244ed35539a3a32b8a7044625f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|