Skip to content

Export traces to Langfuse, Phoenix and Opik

roguebench export turns the sessions of a run into OpenTelemetry traces, so a benchmark run shows up in the observability tool your team already uses: which scenario, which condition, whether the agent caused harm, and every turn and tool call. It reads a run folder (the --out of roguebench run) and needs no extra package.

roguebench export runs/ --format otlp-json -o traces.json                  # a file
roguebench export runs/ --format otlp --endpoint http://localhost:6006     # POST to a collector, Phoenix or Langfuse
roguebench export runs/ --tag gpt-5.6-luna --suite support_agent --max-chars 2000

--format otlp sends OTLP/HTTP with a JSON body to ENDPOINT/v1/traces (an endpoint that already ends in /v1/traces is used as it is). Without --endpoint it reads OTEL_EXPORTER_OTLP_TRACES_ENDPOINT (used as it is) or OTEL_EXPORTER_OTLP_ENDPOINT (gets /v1/traces). Headers come from --header K=V (repeatable) and OTEL_EXPORTER_OTLP_HEADERS (k=v,k2=v2, percent-encoded values); a flag wins over the variable. The command prints header names and the destination without user info or query, never header values, and refuses to send headers over plain http:// to a host that is not localhost. Sessions go out 20 per request (--batch).

The folder under leaderboard/sessions/reference/ has the same layout, so the paper's reference sessions can be exported too. They carry no turn logs, so they give one span per session.

What a trace holds

One trace per session, named SUITE/SCENARIO [CONDITION]:

Span Kind Holds
invoke_agent SUITE/SCENARIO (root) AGENT the session's outcome and totals, below
chat MODEL, one per turn LLM the agent's reply as the output message (with the tool call it made), the previous tool result as input
execute_tool NAME, one per tool call TOOL the tool name, its arguments, its result

Turn and tool spans come from the session logs the suites keep under _work/<tag>/sims/<suite>/logs/. A session without a log (a reference session, or a suite that keeps its logs elsewhere) gets the root span only, with roguebench.turn_log = false. --no-turns drops the child spans.

Root span attributes:

Attribute Meaning
roguebench.suite, roguebench.scenario, roguebench.variant the suite, SUITE/ID, and the variant of the scenario
roguebench.condition incident (the real incident's setup), control (matched placebo), defense, adaptive or adaptive+defense
roguebench.defense, roguebench.run the benchmark-wide defense (D0 is none) and the repetition
roguebench.harm true when the environment's state check found the harm the scenario defines (read from state, never from what the agent said)
roguebench.harm_usd, roguebench.harm_kinds the dollar amount and the kinds of harm the state check recorded
roguebench.utility whether the task was completed, for suites that record it; missing otherwise
roguebench.turns, roguebench.wall_s turns taken and wall-clock seconds
roguebench.tokens_in, roguebench.tokens_out tokens of the whole session (also gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, llm.token_count.*)
roguebench.misreport the agent's final report contradicted the state
roguebench.session_key, gen_ai.conversation.id the session key scenario\|variant\|defense\|model\|run
session.id, langfuse.session.id the run's configuration tag, so one run is one session in the tools' session views

Other attributes are the standard ones each tool reads: openinference.span.kind, input.value, output.value, llm.model_name, llm.input_messages.N.*, llm.output_messages.N.*, tool.name, metadata, gen_ai.operation.name, gen_ai.agent.name, gen_ai.request.model, gen_ai.input.messages, gen_ai.output.messages, gen_ai.tool.name, gen_ai.tool.call.arguments, gen_ai.tool.call.result, langfuse.observation.type, langfuse.trace.name, langfuse.trace.tags, langfuse.trace.metadata.*. The resource carries service.name, service.version and openinference.project.name (--project, default roguebench).

Three things to know when reading the spans:

  • Truncation. Every free-text attribute (replies, tool arguments, tool results, messages) is cut after --max-chars characters (default 4000), with ... [truncated N chars] at the end saying how much was dropped. --max-chars 0 keeps everything. Numbers and flags are never cut.
  • Times. The session rows record only the wall time of the whole session. The root span starts at the run's start time (started in run_<tag>.json; a fixed date when the folder has none) and lasts wall_s, and each turn gets an equal share of it. Use the spans for order and structure, not for latency.
  • Ids. Trace and span ids are hashes of the session key, so exporting a run twice gives the same ids and a backend that deduplicates on them shows each session once. A key that repeats within a file group (the same session key in several repetition files) gets a numeric suffix in the hash.

Langfuse

Langfuse takes OTLP over HTTP, JSON or protobuf, at /api/public/otel with Basic authentication built from the project's public and secret key (docs).

AUTH=$(printf '%s:%s' "$LANGFUSE_PUBLIC_KEY" "$LANGFUSE_SECRET_KEY" | base64)
roguebench export runs/ --format otlp \
  --endpoint https://cloud.langfuse.com/api/public/otel \
  --header "Authorization=Basic $AUTH" --header "x-langfuse-ingestion-version=4"

Use https://us.cloud.langfuse.com/api/public/otel for the US region, or http://localhost:3000/api/public/otel for a self-hosted server (version 3.22.0 or later). Langfuse recommends the x-langfuse-ingestion-version: 4 header; without it traces can take minutes to appear. The root span becomes the trace, tagged roguebench, the suite and the condition, and the run tag becomes the session. Filter on the roguebench.* metadata, for example harm under the incident condition against control.

Arize Phoenix

Phoenix receives OTLP over HTTP at /v1/traces on its port (6006 by default); an instance with authentication takes Authorization: Bearer API_KEY (docs). The openinference.project.name resource attribute picks the project (--project).

roguebench export runs/ --format otlp --endpoint http://localhost:6006 --project rogue-ai-bench
roguebench export runs/ --format otlp --endpoint https://app.phoenix.arize.com --header "Authorization=Bearer $PHOENIX_API_KEY"

Phoenix's documentation describes protobuf as the default body format. This exporter sends JSON. If your Phoenix refuses the JSON body, send to an OpenTelemetry Collector instead: its otlp HTTP receiver accepts JSON and its otlphttp exporter forwards protobuf to Phoenix. The Phoenix Cloud address depends on your space (https://app.phoenix.arize.com/s/SPACE); check the URL in your Phoenix settings.

Opik

Opik accepts OTLP over HTTP only, at https://www.comet.com/opik/api/v1/private/otel for Opik Cloud and http://localhost:5173/api/v1/private/otel for a self-hosted server; Cloud needs the API key in Authorization (no Bearer prefix), a Comet-Workspace header and a projectName header (docs). Opik reads both the GenAI and the OpenInference attributes.

roguebench export runs/ --format otlp --endpoint https://www.comet.com/opik/api/v1/private/otel \
  --header "Authorization=$OPIK_API_KEY" --header "Comet-Workspace=$OPIK_WORKSPACE" --header "projectName=rogue-ai-bench"

The Opik page does not say whether JSON bodies are accepted next to protobuf. If yours refuses them, use the collector route described under Phoenix.

Run the benchmark as an experiment

An export shows runs that already happened. To run the scenarios as a dataset experiment, so that Langfuse or Phoenix lists the model's result next to your other experiments, see examples/langfuse_experiment.py and examples/phoenix_experiment.py in the repository: each puts the scenarios in a dataset (the input is the scenario key, the expected output is no harm), runs each scenario with roguebench run as the experiment task, and scores no_harm. They use the vendors' SDKs, call a real model and a real server, and are not part of the test suite.

Specifications followed

  • OpenInference semantic conventions, spec/attributes/semantic-conventions.md in the Arize-ai/openinference repository, as of 2026-11-28 (attributes marked Development there).
  • OpenTelemetry GenAI semantic conventions from the semantic-conventions-genai repository (status Development): invoke_agent, chat and execute_tool operations.
  • OTLP/HTTP with the JSON encoding: ids as hex strings, 64-bit integers as strings, times in nanoseconds since the epoch.