Phoenix / OpenInference
Kalibra auto-detects OpenInference trace exports from Phoenix. No field mapping needed — just export your spans and compare.
Try the interactive tutorial — run a live agent with your Anthropic key, or use pre-recorded traces to explore instantly.
The workflow
1. Export traces from Phoenix
from phoenix.client import Client
client = Client()
spans = client.spans.get_spans(project_identifier="default")
with open("traces.jsonl", "w") as f:
for span in spans:
f.write(json.dumps(span, default=str) + "\n")
2. Compare with Kalibra
from kalibra.loader import load_traces
from kalibra.engine import compare
from kalibra.renderers import render
baseline = load_traces("before.jsonl")
current = load_traces("after.jsonl")
result = compare(baseline, current, require=["token_delta_pct <= 50"])
print(render(result, "terminal", verbose=True))
That's it. Kalibra detects the OpenInference format from the first line and handles the rest.
What happens under the hood
OpenInference exports are flat arrays of spans — one span per line, each carrying a context.trace_id. Kalibra:
- Groups spans into traces by
trace_id - Builds the span tree using
parent_idrelationships - Extracts tokens and cost from LLM spans (CHAIN/AGENT/TOOL spans have
Nonefor these — they're excluded automatically) - Counts steps as leaf spans, not total spans — orchestration wrappers aren't actions
- Computes duration as wall-clock time (
max(end) - min(start)), not sum of span durations - Parses finish reason from
llm.output_messagesattributes or theoutput.valueJSON (stop_reasonfor Anthropic,finish_reasonfor OpenAI/Google) — used by theerror_rateandsuccess_ratemetrics to detect truncation and errors
What's detected
| Format | Auto-detected | Notes |
|---|---|---|
Phoenix JSONL export (get_spans()) |
Yes | Nested or dot-flattened attributes |
| Phoenix JSON array export | Yes | Same detection logic |
| Flat Kalibra JSONL (one trace per line) | Yes | Default format, no OpenInference needed |
| Nested OTel (child_spans trees) | Yes | JSON array format |