Pular para o conteúdo

AI Agent Observability: Tracing and standards

AI Observability | Cheesecake Labs
Summary
  • Agents can't be monitored like deterministic services: the same input may produce different behavior across runs, and failures often look like success — a well-formed but wrong answer, an expensive detour, or an unnecessary tool call throws no error.
  • Agent observability means tracing every reasoning step, tool call, and model response as nested spans in a replayable hierarchical trace, using the OpenTelemetry GenAI semantic conventions (create_agent, invoke_agent, invoke_workflow, execute_tool, chat/inference) plus mandatory operation duration and token usage metrics, with content capture treated as opt-in for PII safety.
  • Choosing a platform starts with the deployment model, not features: self-hosted (Langfuse, Arize Phoenix) for data sovereignty, managed SDK (LangSmith, Braintrust) for speed to ship, proxy gateway (Helicone) for cost visibility with no code change, or an APM with a dedicated LLM layer such as Datadog LLM Observability; general-purpose tools like CloudWatch, Sentry, or New Relic lack agent semantics on their own.
  • Tracing shows what happened, while eval gates — code-based rules, LLM-as-a-Judge, and human annotation, plus prompt injection detection in security-sensit

Building an AI agent is easy; knowing whether it works in production is not. Once an agent leaves the demo and starts handling real traffic, the hard question stops being “can it do this?” and becomes “why did it just do that?” Answering it requires a kind of visibility that traditional monitoring doesn’t provide.

This article explains what agent observability is, why agents demand a different kind of monitoring than ordinary software, and how to implement it (from the emerging OpenTelemetry standard to the eval gates that catch quality regressions before they ship) without locking yourself to a single vendor.

What Is Agent Observability?

A deterministic service is observable through the three classic pillars: metrics, logs, and traces. When something goes wrong, it returns an error: a 500, a stack trace. You have somewhere to start.

Agents break that model in two ways at once:

  • The same input doesn’t always produce the same behavior. Temperature, retrieval, and tool availability shift the agent’s path, so one prompt can trigger different tool calls on consecutive runs. A single “happy path” trace isn’t enough; you need the distribution of behaviors.
  • Failure rarely surfaces as an error. The agent returns something well-formed, even plausible, but wrong, or it took an expensive detour, or it called a tool it never needed. None of those trips is a 500. Agents fail in ways that look like success.

So binary up/down monitoring is close to useless here. Agent observability is the practice of tracing, monitoring, and evaluating autonomous agents in production, recording every reasoning step, tool call, and model response as nested spans in a hierarchical trace you can replay, all to answer the one question that matters when something breaks: why did the agent do that? And the failure modes worth catching are well documented, evaluations like AgentBench flag the same culprits again and again: weak long-horizon reasoning, poor decisions across many steps, and trouble following instructions.

How Agent Observability Works

The biggest recent advance here isn’t a product, it’s a standard. The OpenTelemetry GenAI semantic conventions define a common vocabulary (gen_ai.*) for AI telemetry: a standard set of span and metric attributes any library can emit and any backend can ingest. Instrument against it and you decouple your instrumentation from the vendor, switching platforms without re-instrumenting your agents.

The standard defines a few span types specific to agents:

  • create_agent: agent instantiation (name, model, config). Fires once, at creation, not per request.
  • invoke_agent: agent execution. It’s client when the agent runs remotely (e.g., OpenAI Assistants, Bedrock Agents) and internal when it runs inside your process (LangChain, CrewAI, LangGraph).
  • invoke_workflow: multi-agent orchestration. The parent span wraps several invoke_agent children, which is what makes handoffs between agents legible in a single trace.
  • execute_tool: a single tool call (name, arguments, result).
  • chat / inference: the model call itself, with model and token usage.

Two more things round out a production-ready setup:

  • Mandatory metrics. Track operation duration (gen_ai.client.operation.duration, latency) and token usage (gen_ai.client.token.usage, input/output). Without these two histograms, you can’t reason about cost or speed. That’s the floor.
  • Deliberate content capture. The body of input and output messages is opt-in, not recorded by default. For systems handling PII, keep content in external storage and hold only a reference on the span, preserving the trace structure for debugging without dumping customer data into your telemetry pipeline.

MCP Tracing: The New Layer

If you use Model Context Protocol (MCP) to integrate tools, the tool layer that was once a black box is now traceable. The OpenTelemetry MCP conventions added attributes like mcp.method.name, mcp.session.id, and mcp.protocol.version.

The design avoids a common trap: instead of creating a duplicate span, MCP instrumentation enriches the existing execute_tool span with these attributes. You get protocol-level detail without a noisier trace, and an agent that calls ten MCP servers becomes as traceable as one calling a single local function.

Choosing Your Stack: Deployment First, Features Second

Once your agent emits spans, they have to go somewhere you can view, search, and evaluate them. That somewhere is an observability platform, and a handful of tools (Langfuse, Arize Phoenix, LangSmith, Braintrust, Helicone, and others) all do the same core job: ingest your traces and give you a dashboard to inspect them. What separates them is less what they do than where they run and who operates them. So before comparing features, decide on the deployment model; that single choice eliminates most of the field. There are three:

  • Self-hosted (you run it): Langfuse, Arize Phoenix. Open-source platforms you install on your own infrastructure, so your trace data never leaves your environment. Best for data residency, sovereignty, and cost control at scale. The price is operational ownership: you keep the servers and database running.
  • Managed SDK (the vendor runs it): LangSmith, Braintrust. A hosted service: you instrument your code with their SDK, and traces flow to their cloud, where a ready-made dashboard awaits. The fastest path to tracing plus built-in eval tooling. The trade is per-trace pricing, and your data lives on their infrastructure.
  • Proxy gateway (you route through it): Helicone. Instead of instrumenting your code, you route your LLM calls through their proxy, which logs every request automatically with near-zero code change and attributes cost across hundreds of models. The caveat: the gateway sits in the request path, so it’s a single point of failure for the whole fleet.

A quick map by situation:

Primary constraint Starting choice
Regulated data / sovereignty Self-hosted (Langfuse / Phoenix)
Speed to ship tracing this week Managed SDK (LangSmith / Braintrust)
Cost visibility with no code change Proxy gateway (Helicone)
Already on a major APM Extend your current APM (Datadog LLM Obs.)

Already run CloudWatch, Sentry, or New Relic? On their own, not enough. Built for latency, error rates, and exceptions, they miss the failures that matter here: a wrong-but-well-formed answer throws no exception and barely moves a latency chart. They lack agent semantics (tool calls, reasoning steps, retrievals), replayable traces, and evaluation. The exception is an APM with a dedicated LLM-observability layer, like Datadog LLM Observability, which adds GenAI span support on top of a stack your team already knows, a legitimate fourth option alongside the three above.

Two notes to close the choice:

  • If you’re on LangChain/LangGraph: LangSmith is usually the lowest-friction option, since the integration is native rather than an adapter. The trade-off is ecosystem coupling. For data ownership instead, Langfuse and Arize Phoenix (the latter with 50+ ready-made evaluation metrics) are the strongest open-source alternatives.
  • Whatever you pick: instrument against the OpenTelemetry GenAI conventions wherever supported, rather than a proprietary SDK. The market is consolidating fast (with acquisitions and large funding rounds in 2026), so standard instrumentation means you re-point the exporter instead of re-instrumenting everything.

Observability in Action: Tracing Plus Eval Gates

Here’s the point that separates a team that “has logs” from a team that controls its agents. Tracing tells you what happened; eval gates tell you whether it was good, and the two need to be wired into the same pipeline.

An

is an automated scorer that grades the agent’s output and can block a regression before deployment or flag a live quality drop. In modern practice, it pairs with component-level evaluation, picking the right evaluator for each part of the agent:

  • Code-based: deterministic rules (e.g., did the router pick the right path, was the output valid JSON).
  • LLM-as-a-Judge: one model grades another’s output against criteria.
  • Human annotation: people score outputs where judgment is subtle.

With those in place, you can measure things like whether the router decided correctly, whether a skill produced the expected result, and whether the number of steps was efficient. In security-sensitive environments, it’s worth folding prompt injection detection into the gate too, since a clean-looking trace can still hide an injected instruction.

The discipline echoes the core principle of agent architecture: just as you add complexity only when it proves itself, you trust an agent in production only when you can measure that it’s good, and prove it again with every change.

Conclusion: You Can’t Improve What You Can’t See

As agents move from pilots into revenue-bearing workflows, observability stops being a nice-to-have. The asymmetry is real: when an agent misbehaves in production, the team that instrumented answers why in minutes by reading a trace, while the team that didn’t is left guessing and re-running.

The good news is that the tooling is maturing fast, and a vendor-neutral standard is emerging underneath it. Instrument against that standard, pick a deployment model that fits your constraints, and put an evaluator behind every trace so quality is something you verify, not assume. Teams that do this debug agents the way they debug any other service. Teams that don’t are stuck re-running prompts and hoping.

References