OpenTelemetry interoperability
opentine v0.5 can act as both a sink and a source for OpenTelemetry GenAI provenance. Import normalizes supported OpenTelemetry content into the sameTraceEvent model as native recording. Export renders a loaded run as GenAI spans or a complete OTLP/JSON document.
Export a portable run
1import json
2from pathlib import Path
3
4from opentine import Run, to_otel_genai, to_otel_genai_document
5
6run = Run.load("run.tine")
7spans = to_otel_genai(run)
8document = to_otel_genai_document(run, service_name="research-agent")
9
10Path("run.otlp.json").write_text(json.dumps(document), encoding="utf-8")
to_otel_genai() returns a list of span dictionaries.to_otel_genai_document() returns a Python dictionary containing a complete OTLP/JSON export document. Both functions are read-only: they do not write a file, open a network connection, or transmit data to a backend.
Export a repository run
1from opentine import Repo, to_otel_genai_document
2
3repo = Repo.open(".")
4run = repo.load_run("heads/main")
5document = to_otel_genai_document(run, service_name="agent")
The same API accepts a v2 Run, a loaded portable artifact, a v3 repository run, one TraceEvent, or an iterable of events. Pass the returned document to the exporter or transport your observability stack expects.
Import from the shell
# Complete OTLP/JSON document
tine import run.otlp.json --format otel-json --save run.tine
# A JSON array or JSONL stream of GenAI spans
tine import spans.jsonl --format otel-spans --repo . --ref heads/importedotel-json accepts complete OTLP/JSON, a spans wrapper, or one span object. otel-spans accepts a JSON array or one span per line. See tine import for destination and overwrite rules.
Modern GenAI message content
The importer understands classic gen_ai.prompt andgen_ai.completion, structured gen_ai.input.messages andgen_ai.output.messages, their JSON-string attribute forms, message and choice span events, and flattened OpenLLMetry and OpenInference shapes. When classic prompt or completion attributes are present, they take precedence.
Round-trip boundary
Export and import preserve the GenAI fields the importer understands, including trace, span, parent and causal-link identity, model, content, and normalized usage. Do not treat the operation as a byte-for-byte archive conversion: timestamps are represented through floating-point seconds, null attributes are omitted, and cost and billing travel in opentine.* attributes that the importer does not restore into their dedicated TraceEvent fields.
Exported spans can contain recorded prompts, completions, and tool content. Inspect the document before sending it outside your trust boundary. The v0.5 implementation targets the OpenTelemetry GenAI semantic conventions as of v1.27.0.