Trace
Definition
A trace is the step-by-step record of a single run of an AI workflow or agent, showing every model call and tool call in order with its inputs, outputs, errors and timing. Reading one shows exactly where a run went wrong.
By Ronan Liedmeier, fractional head of growth and course author · Published 17 October 2026 · Last updated 17 October 2026
Also called: AI trace, agent trace
When a workflow gives a wrong result, the trace is where debugging starts. Failures happen at one specific step, and the final output rarely tells you which.
How it works
A trace is made of steps called spans. Each span records one unit of work, such as a model call or an API request, and all spans in a run share a trace ID so a tool can display them as one timeline, nested by step. OpenTelemetry, an open standard for this kind of recording, defines a span as a unit of work and calls spans the building blocks of traces.
For AI work, the useful trace keeps the raw content: the full prompt sent and the exact tool result returned. A summary of each step is not enough to tell a bad tool result from a bad reading of a good one.
Example
An ecommerce manager has a workflow that writes product descriptions and pushes them to the online store. Some products go live with empty descriptions. The trace shows the model wrote the text fine, but the store's import step expected a differently named field and saved nothing, without raising an error. The fix goes in the field mapping, and the prompt stays as it is.
Common mistake
Guessing the cause from the final output and rewriting the prompt again and again. The cause is often a field mapping or an expired login. Open the trace, find the first step whose output is wrong, and fix it at that step.
Learn it in AI Academy
- Observability & TracingExpert · 8 min
- Debugging AI WorkflowsAdvanced · 14 min
Related terms
- AI observability
- AI observability is the practice of recording what an AI system does on every run, including each model call, tool call, cost and time taken, so you can see why it behaved the way it did. It is how teams debug and monitor AI once it runs on real work.
- Error analysis
- Error analysis is the practice of reading a batch of real AI outputs, noting every way they go wrong, and grouping those failures by type before deciding what to fix or measure. It shows which problems actually happen, so your tests target those.
- Agent loop
- An agent loop is the repeating cycle an AI agent runs to finish a task: it plans a step, calls a tool, reads the result and decides whether to continue or stop. The loop ends when the goal is met or a limit is reached.
- Tool use (function calling)
- Tool use, also called function calling, is when an AI model asks your software to run a specific action, such as a search or a database lookup, and then uses the result in its answer. The model chooses the tool and the inputs; your code runs it.