AIToday
Large Language ModelsAI Coding AssistantsHacker NewsPublished: Jul 31, 2026, 06:00 JST4 min read

OpenTelemetry adds standard tracing for LLM agents

OpenTelemetry adds standard tracing for LLM agents

Key takeaway

  • OpenTelemetry has defined standard semantic conventions for tracing LLM operations—spanning model calls, token counts, finish reasons, and tool invocations—with backing from major cloud vendors and observability companies.

  • The conventions let developers instrument LLM agents once and emit portable telemetry to any OTLP backend, avoiding vendor lock-in while filling a gap where LLM calls have been opaque to traditional observability tools.

3 Key Points

  1. What happened

    OpenTelemetry's GenAI semantic conventions define a shared vocabulary (gen_ai.* attributes and span types like chat, execute_tool, invoke_agent) that vendors including Amazon, Elastic, Google, IBM, Microsoft, Datadog, Langtrace, OpenLIT, Scorecard, and Traceloop have agreed to implement. The conventions are in Development status and live in the open-telemetry/semantic-conventions-genai repository.

  2. Why it matters

    LLM calls have historically been black boxes to observability tools—you see a slow request but not which model ran, how many tokens it consumed, or whether the agent looped on a tool. The standard conventions let teams instrument once using gen_ai.* telemetry and switch OTLP backends later without touching the instrumentation code, keeping the data vendor-agnostic.

  3. What to watch

    The GenAI conventions are still experimental with occasional breaking changes expected as the spec settles, so teams should pin instrumentation versions. The guide demonstrates zero-code auto-instrumentation using opentelemetry-instrument in Python and manual span creation for agent/tool structure, token usage, and multi-turn conversations, with runnable recipes available in the integrations cookbook.

In Depth

Read the full story

OpenTelemetry has published semantic conventions for LLM operations, standardizing how observability tools should record details about AI model calls, agents, and tools. The conventions define a shared vocabulary of attributes and span types (gen_ai.*) that major vendors—Amazon, Elastic, Google, IBM, Microsoft, Datadog, Langtrace, OpenLIT, Scorecard, and Traceloop—have agreed to implement. This agreement occurred while the spec was still in development, signaling confidence in the direction.

The problem the conventions solve is opacity. In traditional tracing, an LLM call appears as a slow HTTP request with no insight into which model was invoked, how many tokens it consumed, whether the agent looped on a tool, or why it stopped. The GenAI conventions capture these details through attributes like gen_ai.request.model (the model name), gen_ai.usage.input_tokens and gen_ai.usage.output_tokens (token counts), gen_ai.response.finish_reasons (why the model stopped, e.g., "stop" or "tool_calls"), and gen_ai.agent.name / gen_ai.tool.name (for agents and their tools). Span names follow a {operation} {model-or-name} pattern—chat gpt-4o-mini, execute_tool get_weather, invoke_agent travel-concierge—making the call stack readable at a glance.

The guide demonstrates implementation in Python using opentelemetry-instrumentation-openai-v2, the official OpenTelemetry instrumentation for the OpenAI SDK. Teams can enable tracing with zero code changes using the opentelemetry-instrument launcher, which auto-instruments every OpenAI call to emit a chat span. Alternatively, manual instrumentation requires calling OpenAIInstrumentor().instrument() and configuring a TracerProvider with an OTLP exporter pointing to a backend (Jaeger, Grafana Tempo, IceGate, or others). Configuration flows through environment variables: OTEL_SERVICE_NAME sets the application name, OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_PROTOCOL specify where traces go, and OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental must be set before the process starts to emit the latest experimental attribute names rather than the older v1.30 defaults.

A critical detail is that OTEL_SEMCONV_STABILITY_OPT_IN cannot be set in Python code after instrumentation loads; it must be exported from the shell or .env before the process starts. Silent fallback to v1.30 attribute names occurs if it is missed, with no warning in the logs. Similarly, OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT defaults to NO_CONTENT (recording only metadata) and can be set to SPAN_ONLY, EVENT_ONLY, or SPAN_AND_EVENT to opt into capturing full prompts and responses—an intentional default for production privacy. The conventions define input and output token counts separately; there is no combined total-tokens attribute, so applications must sum them.

The conventions are still in Development status with most attributes marked experimental, so breaking changes are expected as the spec settles. Teams should pin instrumentation package versions (the guide verifies opentelemetry-distro==0.65b0, opentelemetry-sdk==1.44.0, opentelemetry-exporter-otlp-proto-grpc==1.44.0, opentelemetry-instrumentation-openai-v2==2.4b0, and openai==2.50.0 together as of 2026-07-29 under Python 3.14.5) and monitor the open-telemetry/semantic-conventions-genai repository for updates. The older community instrumentation opentelemetry-instrumentation-openai (from Traceloop/OpenLLMetry) still works and emits the same gen_ai.* attributes, but the v2 package is the official standard. For other providers (Anthropic, Bedrock, Vertex), OpenAI-compatible endpoints, community instrumentors, or framework-native options (LangChain, LlamaIndex, CrewAI) all emit identical gen_ai.* attributes, making the implementation approach interchangeable. The runnable recipes are available in a public integrations cookbook.

Context & Analysis

OpenTelemetry's adoption of GenAI semantic conventions represents the first industry-wide agreement on how to emit observability signals from LLM operations. The working group's membership—spanning hyperscalers (Amazon, Google, Microsoft), infrastructure vendors (Elastic, IBM, Datadog), and LLM-focused observability startups (Langtrace, OpenLIT, Traceloop)—signals that the schema has broad consensus before finalization, reducing the risk of early adopters.

The practical advantage lies in decoupling instrumentation from backend choice. In traditional observability, teams write to vendor-specific SDKs; switching backends requires rewriting instrumentation. With portable gen_ai.* telemetry, the same span emission works across Jaeger, Datadog, IceGate, or any OTLP-compatible receiver. This aligns with OpenTelemetry's broader mission—enabling teams to own their observability data and avoid lock-in—but addresses a unique gap in LLM observability, where model calls, token consumption, and agent loops have historically been invisible to standard tracing tools.

The Development status and experimental attribute designations reflect that the spec is still settling. Teams adopting early must version-pin their instrumentation packages and monitor the open-telemetry/semantic-conventions-genai repository for changes, particularly around the environment variable OTEL_SEMCONV_STABILITY_OPT_IN, which controls whether the instrumentation emits the latest experimental names or the frozen v1.30 defaults.

FAQ

What do the GenAI semantic conventions standardize?
They standardize how LLM operations are recorded using gen_ai.* attributes: the model name, input and output token counts, finish reason (why the model stopped), the operation type (chat, execute_tool, invoke_agent, embeddings), provider name, agent and tool names, and optionally the full prompt and response content.
Can I use these conventions with any observability backend?
Yes. The conventions emit OTLP natively, so any OTLP backend works—including Jaeger, Grafana Tempo, OpenTelemetry Collector, vendor agents, or IceGate (the open-source observability engine used in the guide). You can switch backends later without changing instrumentation.
Are there breaking changes to expect?
Yes. The GenAI conventions are in Development status and most attributes are experimental, so teams should pin instrumentation versions and expect occasional breaking changes as the spec settles. The environment variable OTEL_SEMCONV_STABILITY_OPT_IN must be set before the process starts to opt into the latest experimental conventions; the default v1.30 names are used otherwise.

Get the latest Large Language Models news every morning

AI-summarized, only the topics you pick — one digest a day via Email, Slack, or Discord.

Free · takes 30 seconds · unsubscribe anytime

Related Articles

Next articleNew AI Security Leaderboard Ranks Model Robustness Against Jailbreaks

The AI news that matters, in one minute each morning.

Sign up free