AI Agent Observability: How to Debug Tool-Using Systems in Production
November 2, 2026 · Devhuset Team
An AI feature can return a fluent answer and still have failed. It may have searched the wrong records, called a tool twice, waited on a slow service, or received a technically valid response that did not answer the user's question. Ordinary request logs often show that the endpoint returned 200; they do not show the chain of decisions and actions that produced the result.
That is the practical challenge of AI agent observability. You need to follow one user request across model calls, retrieval, tools and downstream services, while measuring whether the final result was useful—and doing it without turning sensitive prompts into permanent log data.
Start with the journey, not the model call
A conventional web request often has a clear boundary: a request enters an API, code runs, and a response leaves. An agentic workflow can loop through several steps. The model may plan, call a search tool, inspect the result, call a database, and then produce an answer. Some workflows route work to another agent or pause for human approval.
A trace should make that journey legible. Give each user operation a correlation identifier and represent meaningful work as spans: orchestration, retrieval, model inference, tool execution, and calls from a tool to its own dependencies. Propagate trace context when crossing service boundaries, including queues or asynchronous workers, so a delayed step does not appear as an unrelated request.
OpenTelemetry offers a common foundation for traces, metrics and logs. Its GenAI agent and framework conventions describe operations such as invoking an agent, planning, invoking a workflow and executing a tool. Those conventions are currently marked Development, so treat their names as useful guidance rather than a frozen contract. Check the current specification and pin instrumentation versions before building dashboards that depend on provisional attributes.
Make tool activity visible
For every tool call, record a low-sensitivity summary: tool name, operation, start and end time, outcome, retry count, and a stable call identifier that connects the request to its result. Add downstream spans for database queries or external APIs where possible. This lets an engineer distinguish a slow model response from a slow tool or a network timeout.
Do not equate transport success with task success. A tool server can return HTTP 200 while the tool reports an error, returns empty data, or produces a result that fails validation. Record semantic outcomes separately from HTTP status. For example, track whether a lookup returned a usable record and whether the agent proceeded, retried, or stopped.
Also measure repeated calls within one trace. A retry can be sensible after a transient timeout; the same call repeated with identical inputs may indicate a loop. Capture counts and patterns first, then sample traces for investigation. Avoid logging raw tool arguments by default: they can contain customer details, credentials or proprietary information.
Measure quality alongside reliability
Infrastructure signals answer whether the system was available and fast. They do not answer whether it solved the task. Pair latency and error rates with task-level measures such as completion, fallback, escalation to a person, user correction, or a domain-specific validation result.
Define these outcomes before launch. For a support assistant, a successful response might require an answer grounded in an approved record and no unresolved escalation. For a coding helper, it could include a test result or a human acceptance signal. No single metric is a universal quality score; use a small set that reflects the job and review samples of failures.
When you run evaluations, keep them distinguishable from production telemetry but correlate results to the relevant trace or deployment. A model change can improve average quality while increasing latency or tool use. Looking at quality, duration, error rate and tool count together helps reveal that trade-off.
Track latency and cost by step
A single end-to-end duration hides where time went. Break it down into queue wait, retrieval, model time, tool time and any approval pause. Use percentiles such as p50 and p95 rather than relying only on averages: a small number of slow executions can be painful even when the mean looks healthy.
Track token usage and provider/model identifiers where available, then compare cost per completed task—not just cost per request. A workflow that makes several model calls may be more expensive than one that appears to have a low-cost initial response. Attribute downstream service charges separately when they are material.
Keep dimensions bounded. Model, environment, tool name and outcome are usually useful; user IDs, raw prompts and arbitrary request text are poor metric labels. High-cardinality labels inflate storage and can expose personal information. Put sensitive identifiers in access-controlled trace context only when there is a clear operational need and retention policy.
Design for privacy before enabling content capture
Prompts and completions can contain personal, financial or confidential material. The fact that a telemetry system can store them does not mean it should. Begin with metadata: operation names, timing, token counts, error classes and safe correlation IDs. If content is necessary to debug a specific class of failure, make capture opt-in, limit it to appropriate environments or sampled cases, redact it, restrict access and define deletion periods.
Review every exporter and backend in the path. Data may leave the application boundary even when an engineer thinks they are “just adding tracing.” Document which fields are collected, who can query them, where they are stored, and how long they remain. Test redaction with realistic examples before production traffic reaches the pipeline.
Build dashboards around decisions
A useful first dashboard answers a few operational questions: Are tasks completing? Which step is slow? Which tools are failing? Are retries increasing? Is cost per completed task changing? Break results down by release and tool, but keep the number of dimensions manageable.
Alerts should map to action. A rising tool error rate may page the team that owns the integration; a gradual quality decline may create a review task rather than wake someone overnight. Set thresholds from observed baselines and business impact, not arbitrary round numbers. Add a link from aggregate metrics to representative traces so an alert leads to evidence.
Keep a small failure playbook: provider timeout, tool outage, malformed result, empty retrieval, repeated call, and user-facing bad answer. For each, note what the trace should show, whether the system should retry or fall back, and who owns the next step.
Roll out instrumentation in layers
Start with one important workflow and instrument its outer boundary, model calls and highest-risk tools. Verify that one test request produces a connected trace and that errors remain visible even when the HTTP response is successful. Then add outcome measures and cost signals, followed by sampling and retention controls.
Before broad rollout, test failure cases deliberately: delay a tool, return an empty result, trigger a permission error, and interrupt an asynchronous job. Confirm that traces remain connected and that dashboards distinguish these cases. Revisit the design when the workflow changes; new tools and handoffs create new places where context can disappear.
Agent observability is not a transcript of everything the model considered. It is a disciplined record of the system's execution: what components ran, how long they took, what outcomes they returned, and whether the task met its acceptance criteria. With that view—and a careful policy for sensitive content—teams can debug real failures without mistaking a polished answer or a green HTTP status for a reliable product.