Skip to Content

How do I capture prompts and responses with OpenLLMetry?

Rius captures prompts and responses from OpenLLMetry once you point its exporter at the Rius endpoint, with no extra attribute or resource setting. OpenLLMetry’s own attributes are mapped onto the GenAI message attributes when they arrive, and each span shows its prompt and completion in the console. The one setting worth checking is OpenTelemetry’s per-span attribute limit, which matters for long agent runs on older OpenLLMetry releases.

How it works

Rius reads prompts and responses from the GenAI message attributes, gen_ai.input.messages and gen_ai.output.messages, which hold a JSON array of messages. OpenLLMetry has used several conventions over time, and Rius normalizes all of them at ingest:

  • Current releases already emit OTel GenAI (gen_ai.*) attributes, so they arrive in the shape Rius reads.
  • Older releases flatten messages into gen_ai.prompt.* and gen_ai.completion.*. Rius reassembles them into the GenAI message shape.
  • Decorated functions (workflow, task, agent, tool) record traceloop.entity.input and traceloop.entity.output. Rius turns them into the span’s input.value and output.value.

So you do not add a content attribute yourself. OpenLLMetry records prompts and completions by default. If TRACELOOP_TRACE_CONTENT is set to false in your environment, it sends no content, and the spans arrive without messages. Normalized values are stored under the canonical keys, so search and filter on those keys, for example gen_ai.usage.input_tokens rather than gen_ai.usage.prompt_tokens.

A span that arrives without message attributes shows “Content not captured” on its Input / Output tab. Its timings, tokens and cost are unaffected.

Set it up

  1. Point OpenLLMetry’s exporter at Rius. Use the base ingest URL for your workspace’s region (eu here) and your API key in an Authorization header. OpenLLMetry exports OTLP/HTTP protobuf by default, which is what the endpoint expects.
from traceloop.sdk import Traceloop Traceloop.init( app_name="my-agent", api_endpoint="https://ingest.eu.console.rius-glassflow.com", headers={"Authorization": "Bearer <your API key>"}, )
  1. Run one traced LLM call, open Traces in the console, and open the new trace. Select the model-call span and open its Input / Output tab. The prompt and completion should be there, and the span should show a model name and token counts.

  2. If your agent runs long loops on an older OpenLLMetry release, raise OpenTelemetry’s per-span attribute limit. Those releases record messages one attribute per field, and OpenTelemetry SDKs keep at most 128 attributes per span by default and drop the rest without an error. A span over the limit can lose its model, usage or messages. Set the environment variable OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT to 4096 in the process that runs your agent, which is the value the Rius SDKs use.

  3. If content is still missing, check that TRACELOOP_TRACE_CONTENT is not set to false, then check whether something between your app and Rius is removing attributes. A Collector attributes or transform processor that strips gen_ai.* keys will remove prompts and responses. If you route through a Collector, see the OpenLLMetry page and the Trace LLM calls with OpenTelemetry guide for the full setup.

What you get

  • Each model call arrives as a span with the prompt and completion on its Input / Output tab.
  • System prompts sent separately (gen_ai.system_instructions) and the tool definitions the model was shown (gen_ai.tool.definitions) are kept when your instrumentation emits them.
  • Tool and agent steps from Traceloop decorators show their input and output.
  • Model, token and cost analytics work across OpenLLMetry versions, because Rius computes cost from the model name and token counts and you never send a cost attribute.

The Span attribute reference lists every attribute Rius reads and how each OpenLLMetry family maps to it.

When something else fits

  • Two OpenLLMetry details are not mapped yet: the per-completion gen_ai.completion.N.finish_reason of older releases and the flattened tool definitions under llm.request.functions.*. Both are stored under their own names.
  • If you do not already use OpenLLMetry, the Rius SDK sets up tracing with one init() call and adds export-time privacy controls that decide what content leaves your process.

Still stuck? Get help

Last updated on