Skip to main content

Loop Trace Format (LTF) instrumentation and exporters for loop observability

Project description

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.

CI PyPI

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=True for SimEnv, use trace_live_episode() for LiveEnv
  • Exporters — JSONL (built-in), OTLP (optional), LoopNet trajectory mapping
  • Pinslss@1.0.0, les@1.0.0, ltf@0.1.0

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loopotel-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loopotel-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file loopotel-0.1.0.tar.gz.

File metadata

  • Download URL: loopotel-0.1.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for loopotel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 31b276983c3c538cba6b2b885fc4f1bdb0cc0603a61a51d540b710647b59d05a
MD5 969924a5a9dd6d58b103d61f901cb968
BLAKE2b-256 9aa44c2c76cef24ecae5bef4102917b3bfba7d76e4779c4cc6ffd17a9d63e6b3

See more details on using hashes here.

File details

Details for the file loopotel-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: loopotel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for loopotel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3843c7f37dc24e3e09412f9b591410b6ccd10924528dcfaa0af7eec50cd92d2
MD5 7e8cf7ee22d3b0a20762d06cf99a6566
BLAKE2b-256 868d8bfa164687e096e24608e7dcbb8612510244ed35539a3a32b8a7044625f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page