AI Agent Observability: Trace What Agents Really Do

AI Agent Observability: Trace What Agents Really Do

What happens when an AI agent goes off the rails at 2 a.m., burns through hundreds of dollars in model calls, and leaves behind nothing but a vague error in a log file? If nobody can answer that question, the team has a visibility problem, and it is one of the most common reasons agent projects stall before production.

AI agent observability is the practice of capturing enough detail about an agent’s run to explain, after the fact, exactly what it did and why. That sounds simple. In practice, it forces teams to rethink monitoring from the ground up, because an agent is not a single model endpoint. It is a small distributed system that plans, calls tools, loops, retries, and spends money on every step.

Why agent observability is harder than model monitoring

Classic model monitoring watches one request and one response: latency, error rate, token count. An agent breaks that model. A single user question might trigger a dozen model calls, three tool invocations, a retrieval step, and a retry after a failed API call. Measuring each call in isolation tells you almost nothing about whether the overall task succeeded.

The unit of analysis shifts from the request to the trajectory — the ordered record of what the agent decided, which tools it called, with what inputs and outputs, and where it looped or gave up. That is much closer to distributed tracing of a workflow than to watching a model endpoint. Teams that skip this step usually discover the gap the hard way: a user reports a wrong answer, and nobody can reconstruct the path that produced it.

The building blocks: traces, spans, and semantic conventions

The building blocks: traces, spans, and semantic conventions

Observability rests on three signal types: logs, metrics, and traces. For agents, traces do most of the heavy lifting. A trace represents one end-to-end run; each step inside it becomes a span. A well-instrumented agent run looks like a tree: a root span for the task, child spans for each model call and each tool execution, and events attached to spans for individual messages. (Observability)

The open standard behind this is OpenTelemetry, formed in 2019 when OpenTracing and OpenCensus merged under the Cloud Native Computing Foundation. OpenTelemetry defines vendor-neutral APIs, SDKs, and a wire protocol, so instrumentation does not lock a team into one backend. Its semantic conventions for telemetry attributes define standard names for common fields, which is what makes data from different services comparable in the first place. (What is OpenTelemetry?)

For agents specifically, OpenTelemetry added a Generative AI conventions group covering model calls (model name, token counts, prompt and completion attributes) and, later, spans for agent invocation and tool execution. The catch: these conventions have been marked experimental, and attribute names can change between releases. Anyone building dashboards directly on them should pin a version and expect churn. The OpenTelemetry Generative AI semantic conventions document the current attribute set and its status.

Trace identifiers also need to travel. When an agent calls a tool that hits another service, the trace only stays whole if the context propagates. The W3C Trace Context specification, a W3C Recommendation since 2021, standardizes how trace IDs move between services — the plumbing that keeps a multi-service agent run connected.

What to capture on every agent run

Instrumentation decisions are where most teams either win or drown. Capturing everything produces enormous traces and storage bills; capturing too little produces traces nobody can debug. A practical baseline:

  • Task identity. A stable ID for the user request, plus the trace ID that ties every step to it.

  • Model calls. Model name and version, token counts for input and output, latency, and finish reason.

  • Tool calls. Tool name, sanitized inputs, outputs (or hashes), status, and duration.

  • Decisions and branches. Which path the agent chose and what triggered a retry or a stop.

  • Cost. Aggregated per trace, not per API call.

  • Errors and loops. Repeated identical tool calls, timeouts, and guardrail trips.

That last point on cost deserves emphasis. Because one user request can fan out into many model and tool calls, per-request cost and token usage must be summed across the whole trace. A dashboard that reports cost per API call will consistently understate spend and hide the expensive outliers.

A common mistake: logging prompts everywhere

The temptation is to dump full prompts and tool outputs into the observability pipeline. It feels thorough. It also creates a privacy and compliance problem, because prompts and tool results routinely contain personal or sensitive data. Pipelines usually need redaction, hashing, or sampling before storage. In the EU, the General Data Protection Regulation (Regulation 2016/679) sets the rules for processing personal data, and logging customer conversations counts as processing. Sector rules add more constraints on top. The practical fix is to log structure and metadata by default, and gate raw content behind explicit policy.

Sampling and trace propagation: the hard engineering

Long agent runs produce large traces, and storing all of them is rarely affordable. That forces a sampling decision, and the choice matters more than it looks.

Head-based sampling decides at the start of a trace whether to keep it. It is cheap and simple, but it decides before anyone knows whether the run will fail — so the failures a team most wants to see get dropped at the same rate as the boring successes. Tail-based sampling waits until the trace finishes and keeps it based on outcome: errors, high cost, unusual latency. It captures what matters, at the price of buffering traces until completion, which adds infrastructure and memory cost.

A workable pattern for most teams: head-based sampling at a low rate for baseline volume, plus tail-based rules that always keep failed runs and runs above a cost threshold. Trace propagation is the other half of the problem. If the agent calls a tool that calls a downstream service, the trace stays connected only if the context is passed along every hop — which is exactly what the W3C standard above exists to guarantee.

Observability is not evaluation

These two get conflated constantly, and the confusion causes real design mistakes. Observability captures what happened at runtime: the trajectory, latency, cost, errors. Evaluation scores quality: was the answer correct, grounded, and on task. An agent can be perfectly observable and still be wrong on every request; a good evaluation score tells you nothing about why a specific run took 40 seconds.

Mature teams join the two. An eval score gets attached back onto the trace that produced it, so a quality drop can be traced to a specific tool, prompt version, or model change. That linkage is where debugging actually gets fast. It also pairs naturally with the discipline of testing AI agents before granting write access, since the same traces that prove a test run behaved correctly become the evidence base for expanding what the agent may touch.

Security, permissions, and what traces reveal

Observability data is itself a security asset and a security risk. On the asset side, traces show exactly which tools an agent invoked and with what authority, which is invaluable when investigating an incident. On the risk side, a trace store holding raw prompts, credentials echoed into tool inputs, or customer records becomes a high-value target.

This is why access to agent traces should follow the same least-privilege thinking applied to the agent itself. The principle behind giving an AI agent the minimum permissions it needs applies to the people and systems reading its telemetry too: read-only access for most engineers, scoped access for raw content, and retention limits that match policy. Public-sector guidance reinforces the point. The NIST AI Risk Management Framework, published in January 2023, treats logging and monitoring as part of governing AI systems, not as an afterthought bolted on after launch.

How the tools compare, honestly

The vendor landscape is crowded, and marketing outruns substance. A rough map of the options:

Approach Strength Weakness
OpenTelemetry plus a general backend Vendor-neutral, reuses existing tracing infrastructure GenAI conventions are experimental; agent semantics need custom work
Agent-specific observability platforms Agent and eval views out of the box Proprietary formats, lock-in risk, claims need verification
Homegrown logging and dashboards Full control, tailored to the team Expensive to build and maintain; easy to miss propagation and sampling
Evaluation-only tooling Strong on quality scoring Blind to runtime cost, latency, and failure paths

The honest summary: there is no single agreed definition or standard for AI agent observability. The term gets used for runtime tracing, for evaluation, and for guardrails, sometimes all at once. Vendor claims should be checked against the actual specification before anyone signs a contract. Teams following industry news closely will notice how quickly the category shifts, and it pays to track the news rather than assume last quarter’s comparison still holds.

In practice, most teams that succeed start with OpenTelemetry instrumentation and a backend they already run, then add agent-specific tooling only when a concrete gap appears. Starting with a specialized platform before the team knows what it needs to see usually produces an expensive dashboard nobody opens.

Practical steps that actually work

A sequence that holds up in real deployments:

  • Instrument the trajectory first. Get root spans, model spans, and tool spans flowing before worrying about dashboards.

  • Aggregate cost per trace from day one. Retrofitting cost attribution later is painful.

  • Default to metadata, gate raw content. Decide redaction policy before the first production prompt is logged.

  • Sample by outcome. Always keep failures; sample successes.

  • Attach eval scores to traces. Close the loop between quality and runtime behavior.

  • Review traces after every incident. Traces are only useful if someone actually reads them.

The most common failure mode is not missing tooling. It is instrumenting the model call and stopping there, which produces beautiful dashboards that cannot answer the only question that matters during an incident: what did the agent actually do?

Conclusion

AI agent observability is less a product category than a discipline: represent each run as a trace, capture the trajectory rather than the individual call, aggregate cost across the whole task, sample by outcome, and treat prompts as sensitive data. The standards are still settling — OpenTelemetry’s GenAI conventions are experimental, and the industry has not agreed on a definition — so the teams that do well build on open foundations and stay skeptical of anyone selling certainty. The payoff is simple and worth the effort: when an agent misbehaves at 2 a.m., someone can open a trace and explain exactly why.

What is AI agent observability?

It is the practice of capturing runtime detail about an AI agent’s run — the sequence of model calls, tool calls, decisions, costs, and errors — so the behavior can be reconstructed and explained afterward. It extends classic observability (logs, metrics, traces) to multi-step, tool-using systems, where the unit of analysis is the whole trajectory rather than a single model request.

How is agent observability different from LLM monitoring?

LLM monitoring watches individual model requests: latency, tokens, errors. Agent observability follows the entire task across many model and tool calls. Because one user question can trigger dozens of calls, per-request metrics hide loops, runaway costs, and the exact step where a task failed.

Are OpenTelemetry’s GenAI conventions stable enough to build on?

Not fully. The Generative AI semantic conventions have been marked experimental, and attribute names can change between releases. Teams can build on them, but should pin a version, isolate the mapping layer, and expect to update it. Treat vendor claims of full compliance as something to verify against the specification.

What should be logged from an agent run?

At minimum: a stable task ID and trace ID, model name and version, token counts, tool names with sanitized inputs and outputs, status and duration per step, retry and loop signals, and cost aggregated per trace. Raw prompts and tool outputs should be redacted, hashed, or gated behind policy, since they often contain personal data.

Why does sampling matter so much for agents?

Long agent runs produce large traces, so storing all of them is expensive. Head-based sampling decides before anyone knows whether a run will fail, so failures get dropped along with successes. Tail-based sampling keeps traces based on outcome, which preserves the failed and costly runs that teams most need to inspect.

Do I need evaluation tooling as well as observability?

Usually, yes. Observability shows what happened at runtime; evaluation scores whether the result was any good. Joining eval scores back onto traces lets a quality drop be traced to a specific tool, prompt version, or model change, which is where debugging gets genuinely fast.

Latest articles

Scroll to Top