Trace
Definition
A record of every step in one AI request or agent run: prompts, model responses, tool calls, retrieved context, tokens, timing and cost.
In more detail
Traces are made of nested spans, much like traces in distributed systems, and many tools use OpenTelemetry. They are the raw material for debugging and for building eval sets.
A trace for an agent run typically holds a root span for the request, child spans for each model call with the prompt, response, tokens and latency, and spans for tool calls and retrieval with their inputs and outputs. The OpenTelemetry GenAI semantic conventions standardise attribute names, so libraries such as OpenLLMetry can send the same traces to different backends. Because traces contain user data, decide what to redact and how long to keep them.
Related terms
Error analysis
Reading a sample of real outputs, labelling what went wrong and grouping the failures before deciding what to measure or fix.
LLM observability
Collecting traces, costs, latency and quality signals from AI applications in production so you can debug and improve them.
Trajectory evaluation
Evaluating the sequence of steps an agent took, its tool calls, arguments and order, rather than only its final answer.
Online evaluation
Scoring a sample of real production traffic continuously, with automated checks or judges, to catch problems that offline test sets miss.
Read more about Trace
- Add tracing and cost tracking to an LLM app
One trace per user action, with tokens, latency and cost for each model call, so slow and costly features stand out.
- OpenLLMetry
OpenTelemetry instrumentation for LLM providers, vector databases and frameworks.
- Trajectory evaluation
Evaluating the sequence of steps an agent took, its tool calls, arguments and order, rather than only its final answer.