lowob

What Are Traces and Spans in LLM Applications?

LLM tracing records the full journey of one request through your AI application: the trace is that journey, and spans are its individual steps, such as a model call, a tool call or a retrieval. Each span carries timing, tokens and errors. Agents need tracing most, because one answer can involve many model and tool calls you didn't script.

IN SHORT: A trace answers "what happened on this request, in what order, and what did each step cost?" OpenTelemetry, the open standard for telemetry, gives AI steps shared names like chat, execute_tool and invoke_agent, though those names are still at Development status. Turn tracing on before you ship an agent, keep prompt capture off until you've thought about personal data, and pick a tool that accepts OpenTelemetry data so you're not locked in.

Key facts

Trace The path of one request through your app; every span in it shares one trace ID
Span One unit of work: name, parent span ID, start and end timestamps, attributes, events, links, status
Span status values Unset (default), Error, Ok
Span kinds Client, Server, Internal, Producer, Consumer
GenAI conventions status Development, as of November 28, 2026; moved to the separate semantic-conventions-genai repository
Model call span name {gen_ai.operation.name} {gen_ai.request.model}, for example chat plus the model name
Tool and agent span names execute_tool {gen_ai.tool.name}; invoke_agent {gen_ai.agent.name}
Prompt and response capture Off by default (NO_CONTENT), opt-in via OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT
Last checked November 28, 2026

What is a trace, and what is a span?

A trace is the complete record of one request, from the moment it enters your system to the moment you send the answer back. OpenTelemetry's own docs describe traces as the big picture of what happens when a request is made, whether your app is one service or many.

A span is one unit of work inside that trace. Spans are the building blocks. Per the OpenTelemetry docs, each span holds:

  • A name, such as chat or execute_tool lookup_order.
  • A parent span ID, which is empty for the root span (the first span, which covers the whole request).
  • Start and end timestamps, so you can see duration and order.
  • Span context: the trace ID it belongs to and its own span ID.
  • Attributes: key-value pairs, such as the model name or tokens used.
  • Span events: timestamped notes inside the span, such as an exception.
  • Span links: pointers to related spans in other traces.
  • Span status: Unset by default, Error if something failed, or Ok if you explicitly mark it successful.

Spans nest. A child span is a sub-operation of its parent, which is how a trace becomes a tree rather than a flat log. That tree is the whole point: it shows which step called which, and where the time went.

If you already know this: span kind is a hint to the backend about how to assemble the tree. A Client span is an outgoing remote call (a request to a model provider's API, say), Internal stays inside one process, and Server, Producer and Consumer cover incoming calls and queued jobs. If no kind is set, Internal is assumed.

Why do LLM apps and agents need tracing?

Because the model, not your code, decides some of the steps. In a normal web app, you wrote every function call, so a stack trace and a log line usually tell you what went wrong. In an agent, the model chooses which tool to call, with what arguments, and whether to call another model afterward. The same question can take three steps on Monday and twelve on Tuesday.

That creates four problems that only a trace solves:

  1. Wrong answers. You need to see which step produced the bad input. Was the retrieval empty, did the tool return an error, or did the model ignore a correct tool result?
  2. Slow answers. A five-second response might be one slow tool, not a slow model. The timeline shows it at a glance.
  3. Cost. Tokens are billed per model call. A trace adds them up per request, so you can see that one kind of question costs ten times another.
  4. Loops. Agents sometimes repeat a tool call or keep re-planning. A trace with 30 spans where you expected 6 is the fastest way to spot it.

The OpenTelemetry GenAI metrics even include counters built for this: gen_ai.invoke_agent.inference_calls and gen_ai.invoke_agent.tool_calls, which count model and tool calls per agent run.

What does an agent trace look like?

Waterfall chart of one illustrative agent trace: a root invoke_agent span of about 4.8 seconds containing three chat model spans and two execute_tool spans, laid out on a 0 to 5 second timeline.

Here is one illustrative trace for a support agent asked "Where is order 1042?". The names follow the OpenTelemetry GenAI conventions; the timings and the model name are made up for the example.

Span Parent Kind Illustrative duration What it records
invoke_agent support_agent none (root) Internal 4.8 s The whole run
chat model-a root Client 1.2 s Model decides to look up the order
execute_tool lookup_order root Internal 0.5 s Order database call
chat model-a root Client 0.9 s Model decides to check shipping
execute_tool track_shipment root Internal 0.6 s Carrier API call
chat model-a root Client 1.0 s Model writes the final answer

Six spans for a simple question. Add retrieval, a guardrail check, a retry and a sub-agent, and 20 or more spans per answer is easy to reach. Here's what one model-call span might carry, using attribute names from the current conventions (values illustrative):

{
  "name": "chat model-a",
  "kind": "CLIENT",
  "trace_id": "5b8aa5a2d2c872e8321cf37308d69df2",
  "parent_id": "a1f0c3d2e4b5a697",
  "attributes": {
    "gen_ai.operation.name": "chat",
    "gen_ai.provider.name": "openai",
    "gen_ai.request.model": "model-a",
    "gen_ai.conversation.id": "conv_7781",
    "gen_ai.usage.input_tokens": 1840,
    "gen_ai.usage.output_tokens": 96,
    "gen_ai.response.finish_reasons": ["tool_calls"]
  },
  "status": "Unset"
}

Read that span and you know which provider was called, how many tokens went in and out, and that the model stopped to request a tool, not because it finished. Multiply by every span and you have the full story of the request.

Which OpenTelemetry GenAI attributes matter?

Start with the handful that tell you what was called, what it cost and how it ended. The full list is long; these are the ones we'd make sure every span carries.

Attribute Requirement level What it tells you
gen_ai.operation.name Required The operation: chat, generate_content, execute_tool, invoke_agent and so on
gen_ai.provider.name Required Who served it, for example openai, aws.bedrock, gcp.vertex_ai
gen_ai.request.model Conditionally required (if available) The model you asked for
gen_ai.response.model Recommended The model that actually answered, which can differ
gen_ai.usage.input_tokens / output_tokens Recommended Tokens billed for this call
gen_ai.usage.cache_read.input_tokens Recommended when non-zero Tokens served from the provider's cache
gen_ai.response.finish_reasons Recommended Why the model stopped
gen_ai.conversation.id Conditionally required Ties spans from one chat session together
gen_ai.tool.name Required on tool spans Which tool ran
error.type Conditionally required on error The class of failure (this one is Stable)

Three things in the fine print are worth knowing:

  • Status is Development. Every gen_ai span and attribute in the GenAI repository showed Development status when we checked on November 28, 2026. Development status means names can still change, so pin the version your instrumentation uses.
  • The conventions moved. The GenAI pages on opentelemetry.io now point to a separate repository, open-telemetry/semantic-conventions-genai, and say the old location is no longer maintained.
  • Agents versus workflows. The agent span uses invoke_agent when the model drives control flow through tool calls, and invoke_workflow when your application defines the flow, as with a LangGraph graph or a CrewAI crew.

Should traces record prompts and responses?

Only when you've decided to, because prompts often contain customer data. Under the GenAI conventions, the message attributes (gen_ai.input.messages, gen_ai.output.messages, gen_ai.system_instructions) are opt-in. The setting is an environment variable, OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT, with four values: NO_CONTENT (the default), SPAN_ONLY, EVENT_ONLY and SPAN_AND_EVENT. An invalid value falls back to no content.

There is also a middle path: the conventions define _ref attributes, such as gen_ai.input.messages_ref, that point to content stored somewhere else (an S3 bucket, for example). That keeps the trace light and lets you apply stricter access rules to the text itself.

Our view: in development, capture everything. In production, start with no content, add it for a sampled slice of traffic, and make sure whoever can read traces is allowed to read customer messages.

Which tools support LLM tracing?

Most LLM tracing tools now accept OpenTelemetry data, so the choice is less about lock-in than it was. This summary is based on each project's public README as of November 2026, not hands-on testing.

Tool License How it relates to OpenTelemetry Self-host
Langfuse MIT Says it's built on OpenTelemetry; accepts OTLP traces from any instrumented app or collector. Part of ClickHouse since January 2026, per its README Yes
Arize Phoenix Elastic License 2.0 (source-available) Tracing uses OpenTelemetry-based instrumentation via Arize's OpenInference libraries Yes; Arize AX is the managed option
OpenLLMetry (Traceloop) Apache 2.0 A set of OpenTelemetry extensions; sends to existing observability backends Instrumentation only, not a backend

Your existing application monitoring vendor may also ingest GenAI spans. If you already pay for one, check its GenAI support before adding a separate tool. Our pages on LLM observability vs APM and what LLM observability is cover that decision.

What we'd do

  1. Instrument one flow this week. Pick your highest-traffic AI feature and add OpenTelemetry-based instrumentation for your framework. Don't start with everything.
  2. Name the root span after the job. invoke_agent support_agent is searchable; run isn't.
  3. Set gen_ai.conversation.id. Without it you can't stitch a multi-turn chat back together.
  4. Leave content capture at NO_CONTENT in production until someone has signed off on what's stored and who can read it.
  5. Build three views: cost per trace, spans per trace, and error rate by tool. The second one catches loops.
  6. Pin the conventions version in your instrumentation, because Development-status names can change.
  7. Review ten traces by hand each week. Read them like transcripts. You'll find problems no dashboard shows.

Common questions

What is LLM tracing?

LLM tracing records every step your application takes to answer one request: each model call, tool call and retrieval, with timing, tokens and errors. The full record is a trace, and each step inside it is a span.

What's the difference between a trace and a span?

A trace is the whole journey of one request. A span is one unit of work inside it, with a name, start and end time, attributes and a parent. Every span in a trace shares the same trace ID.

Why do AI agents need tracing more than chatbots?

An agent decides its own steps, so one answer can involve many model and tool calls in an order you didn't write. Without a trace, you only see the final answer, not which step went wrong or which one burned the tokens.

What are the OpenTelemetry GenAI semantic conventions?

A shared set of span names and attribute names for AI operations, such as gen_ai.operation.name and gen_ai.usage.input_tokens. They let any compliant tool read your traces. As of November 28, 2026 they are at Development status, so names can still change.

Does LLM tracing record prompts and responses?

Not by default under the OpenTelemetry GenAI conventions. Content capture is opt-in and controlled by OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT, which defaults to NO_CONTENT. Turn it on deliberately, and think about personal data first.

What is a root span?

The first span in a trace, with no parent. It covers the whole request from start to finish. In an agent trace it is usually the invoke_agent or invoke_workflow span.

Which tools support LLM tracing?

Open-source options include Langfuse (MIT license), Arize Phoenix (Elastic License 2.0, self-hosted) and Traceloop's OpenLLMetry instrumentation (Apache 2.0). All three are built on or accept OpenTelemetry data.

Is LLM tracing the same as LLM observability?

Tracing is the core of it. Observability adds metrics, such as cost and latency over time, and evaluations, which score whether answers were any good. You need traces first because the other two are built from them.

Sources

Last checked November 28, 2026. Written by Chris Wells, lowob.

How to cite this

Free to quote and link with credit. Please link to this page when you use a figure, chart or framework from it.

Cite as: Wells, C. (2026). What Are Traces and Spans in LLM Applications?. lowob RESEARCH. Published 29 November 2026, updated 29 November 2026. https://lowob.com/research/what-are-traces-and-spans-in-llm-apps/

BibTeX
@online{lowob2026whataretracesandspansinl,
  author  = {Wells, Chris},
  title   = {What Are Traces and Spans in LLM Applications?},
  organization = {lowob},
  date    = {2026-11-29},
  urldate = {2026-11-29},
  url     = {https://lowob.com/research/what-are-traces-and-spans-in-llm-apps/}
}

Using a chart? Each chart has its own link. Charts and data tables are licensed CC BY 4.0: reuse them with the credit line "Source: lowob RESEARCH" and a link to this page.

Changelog

29 Nov 2026: First published.

LLM Observability vs Application Monitoring

Read next