Agent traces
Records of what an agent did and why, used for debugging and review.
An agent trace is a record of what the agent did and why: the prompts, tool calls, results, and decisions along the way. Traces are how you debug a run that went sideways, compare two prompts, or audit what an agent changed in a repo. Without them you only see the final answer, which is rarely enough.
A useful trace is structured, not just a log file. Each step should name the tool, the arguments, the result, and the time it took. Keep model output and tool output distinct so you can tell a reasoning error from a tool failure. If several agents work together, give each a stable id so you can follow the handoff.
Most tracing systems model each request as a tree of timed spans: a root span for the request, with child spans for every model call, retrieval, and tool call. Record the prompt version, model name, token counts, latency, and cost on each span. Open standards such as OpenTelemetry now define conventions for these fields, so traces can flow into ordinary observability tools. The best use of a failed trace is to turn it into a test case for your evaluation set, then confirm the fix with the next trace.
Treat traces as a product surface for the people who maintain the agent. A short, readable timeline beats a pile of raw JSON. Redact secrets before you store or share a trace. Keep enough history to replay a bad run, but not so much that you cannot find the interesting one.
When something fails in production, the first question is usually 'what did it just do?' If you can answer that from a trace in a minute, the rest of the debugging gets much easier.