Introduction: A Status Code Describes an Exchange, Not an Outcome
A 200 says one HTTP exchange completed: a request arrived, a server answered, and the response landed in the success class. Everything else is left to the reader's assumptions, and most monitoring was designed for a world where those held.
Agents break them. A 2026 write-up on AI observability from Kong states the core problem in one sentence: every request returned 200 OK, yet the task still failed. That is not a bug report about one product. It describes a shape in which the unit that succeeds and the unit that fails are not the same unit.
Problem Overview: One Intent, Many Calls
One user intent does not become one call. It fans out into multiple model calls, tool invocations, MCP interactions, policy executions, retries and agent handoffs. Each is an independent network operation with its own timeout, failure probability and definition of success, and the agent decides what to do next from what came back.
Partial failure is the normal case. When a step fails, a well-built agent retries, re-plans, or continues with a degraded result, and the session absorbs the failure. That absorption is what makes the failure unreadable: an absorbed failure looks like a success in every request-level counter you own.
The arithmetic explains the frequency. Eight sequential steps at 99% success each produce a clean session roughly 92% of the time, and few agent loops hold 99% at every step. The useful question is not whether sessions fail, but how.
Per-endpoint latency and error rate cannot answer it. Error rate divides by requests, so a session that retries six times and succeeds contributes seven successes and a latency spike, while one that gives up contributes six successes and one error, if the final failure maps to a status code at all. Latency averages weight a session by its call count, letting one looping session with sixty spans move the mean further than sixty healthy ones. And p95 session duration, the number that matches what a user waits for, is not produced by a pipeline instrumented per request.
Volume compounds it: a 2% error rate over a few hundred requests is a handful of failures in noise. The write-up draws the only conclusion available: the session, not the request, is the unit of observability for AI applications.

Figure 1: one user intent fanned out into model calls, tool invocations, MCP calls, policy checks, retries and handoffs. Every individual request returns 200; the branch that returned an empty tool result is where the task died, and no request-level dashboard marks it.
Technical Deep Dive: The Trace Shape of One Agent Turn
A typical agent turn produces a trace hierarchy: invoke_agent to chat to execute_tool to tools/call to an HTTP request. Read that chain as a delegation of responsibility, because during an incident the only question is which span owns the failure.
The OpenTelemetry GenAI semantic conventions split the spans in two. Model-operation spans cover chat, text_completion and embeddings. Agent-operation spans cover invoke_agent, create_agent and execute_tool, and the MCP sub-spec covers the tools/call interaction between the agent and whatever it calls.
Ownership is the useful part. The HTTP span owns transport: connect, TLS, status, bytes. tools/call owns protocol: a result or a JSON-RPC error. execute_tool owns semantics: whether the arguments were valid and whether the agent understood the result. chat owns the model response and its token accounting. invoke_agent owns the turn, and the trace owns the task.
That is why a 200 answers the wrong question. A tool returning an empty array with a well-formed response is a protocol success, a semantic failure and a task failure at once, and each lives in a different span. The transport cannot tell an empty result from a correct one.

Figure 2: the waterfall of one agent turn. execute_tool wraps the decision to call a tool, tools/call carries the MCP exchange and the innermost HTTP span covers transport. The failing span is the tools/call that returned an empty result set; every span above it reports success.
The Attributes That Make a Trace Queryable
A hierarchy you cannot filter is a picture, not a signal. The conventions define gen_ai.provider.name, gen_ai.operation.name, gen_ai.request.model, gen_ai.response.model, gen_ai.usage.input_tokens and gen_ai.usage.output_tokens, and the MCP sub-spec adds mcp.method.name, mcp.protocol.version and mcp.session.id.
Each earns its place. gen_ai.operation.name groups spans across services, so failing execute_tool spans from a planner and a worker land in one query. gen_ai.request.model is what you asked for; gen_ai.response.model is what answered, and they diverge when a provider routes elsewhere, so a model change you did not deploy shows up as a behaviour change worth seeing.
One caution on mcp.session.id: it names the MCP session, not your task. A task can cross several MCP sessions or none, so carry an application-level session identifier and group on that, or the trace tree is the only thing tying a task together.
Failure Modes: What Each Layer's Success Hides
This is the table I use when someone asks why the dashboard is green. The request column is what existing instrumentation reports, the session column what the trace shows, and the last column what only an outside check can tell you.
| Failure type | Request level | Session level | External task check |
|---|---|---|---|
| HTTP failure | 5xx or timeout, visible | One span errors, a retry may absorb it | Usually invisible |
| Model refusal | 200 carrying a refusal body | Session completes, nothing done | Wrong outcome |
| Tool error | 200 carrying an error payload | execute_tool errors, loop continues | Often invisible |
| MCP session loss | JSON-RPC error in tools/call | Turns fail or run without tools | Degraded outcome |
| Retry storm | 200s, latency climbing | Duration and cost up | Slow, then failing |
| Silently wrong output | 200 | Every span reports ok or unset | Wrong outcome |
| Truncated final answer | 200, short body | chat span succeeds, output tokens high | Partial answer |
Two rows matter most, because no instrumentation quality makes them visible at request level: silently wrong output and truncated final answer. Both arrive as a 200 with a well-formed body, both produce a complete span tree, and both leave the user with something other than what they asked for. Only a check that knows the expected outcome can tell.
The retry row corrupts your own numbers. Retries turn request failures into request successes while the session gets slower and more expensive, so a rising retry rate appears as stable error rate plus unexplained latency.
Debugging Workflow: From a Failed Session to a Failing Span
Assume a report says the agent gave a wrong answer and every dashboard is green. The workflow moves from collector to session to span, in that order, so you never spend an hour querying traces that were never ingested.
Step 1: prove the collector is accepting work. Run this in bash against the config you deploy:
otelcol validate --config ./otel-collector.yaml
Validation catches the failure that ruins the investigation: a pipeline referencing a component that does not exist, or a receiver bound to a busy port. A collector that never starts produces an empty trace store, which looks exactly like an agent that never ran. Here is the shape the conventions describe, as YAML, with OTLP receivers, a memory_limiter and a batch processor, and an otlphttp exporter to Tempo:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
memory_limiter:
check_interval: 1s
limit_mib: 512
batch: {}
exporters:
otlphttp:
endpoint: http://tempo:4318
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp]memory_limiter goes first and batch last: the limiter must refuse work before the batch holds it, and the batch must collect before the exporter sends. Reversing that order passes validation and fails under load.
Step 2: send one span yourself. This is an OTLP/HTTP JSON export to the 4318 receiver:
curl -sS -o /dev/null -w '%{http_code}\n' -H 'Content-Type: application/json' \
-X POST http://localhost:4318/v1/traces \
-d '{"resourceSpans":[{"scopeSpans":[{"spans":[{"traceId":"5b8efff798038103d269b633813fc60c","spanId":"eee19b7ec3c1b174","name":"smoke-test","kind":1,"startTimeUnixNano":"1700000000000000000","endTimeUnixNano":"1700000001000000000"}]}]}]}'Read the status, not the body. A 200 with an empty JSON object means the collector accepted the batch; 415 means the content type did not match the encoding, 400 means the payload was malformed, and a refused connection means nothing listens on 4318. If this fails, stop: you are debugging delivery.
Step 3: find the failing sessions with TraceQL. These queries assume spans are named after the conventions:
{ name = "invoke_agent" && status = error }
{ name = "invoke_agent" } >> { name = "execute_tool" && status = error }The first selector finds turns whose root agent span was marked as an error. The second uses the descendant operator to find traces where an execute_tool span failed below an invoke_agent span even if the turn recovered. That query surfaces absorbed failures: a parent can be healthy while its child is not.
Step 4: attribute the failure with jq. Run this in bash to save the search results to search.json, print them, then rank the failing span names inside them:
curl -sG http://tempo:3200/api/search \
--data-urlencode 'q={ name = "invoke_agent" && status = error }' \
--data-urlencode 'limit=200' \
-o search.json
jq -r '.traces[] | [.traceID, .rootServiceName, .rootTraceName, .durationMs] | @tsv' search.json
for t in $(jq -r '.traces[].traceID' search.json); do
curl -s "http://tempo:3200/api/traces/$t" \
| jq -r '.batches[].scopeSpans[].spans[] | select(.status.code == 2) | .name'
done | sort | uniq -c | sort -rn | head -20In OTLP JSON the status code is an enum where 2 means error, so the filter keeps exactly the spans the SDK marked failed. The count is the answer you want before reading a single trace: execute_tool dominating means the model is producing arguments your tools reject, tools/call dominating means the integration is failing. Then read upward, because the deepest failing span is the cause and the root is only the symptom.
If the count is empty and users still complain, the failure is not represented in your spans, which is where most agent stacks sit.
Monitoring Strategy: Signals With Starting Thresholds
Everything below is a starting heuristic, concrete enough to implement and meant to be tuned against your baseline. The unit never changes: each signal is computed over sessions or over spans aggregated into sessions, never over raw requests.
- Task success rate. Completed sessions over started sessions, classified by outcome rather than status. Page on a 20% drop against a seven-day baseline, roughly where a regression stops looking like variance. This is the only signal that refuses to accept a status code as an answer.
- Turns per session. Alert when p95 turns exceed twice baseline for thirty minutes. Turn count climbs before success falls, because a loop that eventually gives up ran four extra times first.
- Retries per session. Alert at p95 of three retries, or when retries pass 10% of tool calls. Retries are the mechanism that hides failures from request-level metrics, so measuring them is how you stop being surprised, and a retry rate rising while success holds steady predicts the success drop by days.
- Tool error rate. Error status on execute_tool and tools/call over total tool spans, alerting above 2% for fifteen minutes. Keep the series apart: an execute_tool error is usually an argument problem, a tools/call error usually the integration, and merging them pages the wrong team.
- Tokens and cost per completed task. Alert when either exceeds 1.5 times baseline, read by model, by agent and by consumer, the breakdown the write-up names explicitly. A struggling session spends its budget on the wrong branches, so the token curve moves before the success curve.
- p95 session duration. Alert at twice baseline or half the client timeout, whichever is lower, and track turn latency separately: fifty seconds against a sixty-second timeout is a failure that arrives on time.
- Cache status, inference inputs and outputs. Not alerts, but the material for classifying a wrong answer: cache status separates a slow first call from a slow repeated one, and stored inputs and outputs are the only way to tell a refusal from a hallucination from a truncated answer.
Best Practices: Designing the External Task Check
The check that closes the gap has one job: start a session, know the answer independently, and fail when the answer is wrong. It must run outside the agent's telemetry, because a check that reads the agent's spans inherits every blind spot.
- Pin the expected outcome before the session runs: a canary prompt with a verifiable ground truth against a canary tenant whose tool results you control, so a correct answer is a fact rather than an opinion.
- Assert on the artifact, not the status. Parse the response and compare the field, the count or the schema. A 200 with an empty list is the failure this check exists to catch.
- Separate the two failure shapes. Session did not complete is a different page from session completed with the wrong outcome, and merging them trains the on-call engineer to guess.
- Bound cost and blast radius. Cap turns, set a token budget, and use a tenant that cannot touch real billing or customer data. A synthetic session is not free and must never move money.
- Run it from more than one place. Your dependency set now includes providers you do not operate, so a single vantage point reports that provider's state as confidently as it reports yours.
Here is the assertion as a shell command, with jq's exit code as the verdict:
curl -sS -X POST "$AGENT_URL/v1/sessions" -H 'content-type: application/json' \
-d '{"intent":"report the status of order 4471","canary":true,"max_turns":8}' \
| jq -e '.result.order_status == "shipped" and .turns < 8'jq -e exits non-zero when the expression evaluates to false or null, so the check maps straight onto a monitor's success condition with no parsing in between. Log the response body with the exit code, or a failing check becomes a boolean with no evidence attached.
Frequently Asked Questions
Why do agent dashboards stay green while tasks fail?
Because the dashboard is built from request-level data and the request succeeded. A failing session usually fails after every call returned a valid response: an empty tool result, a refusal, a truncated answer. Each of those is a 200.
Is APM or LLM observability enough?
It is necessary and not sufficient. Traces that follow the GenAI conventions give you the span hierarchy, the model identity and token counts, which is what you need to explain a failure after you know it happened. They cannot tell you the answer was wrong, because being wrong is not a property of any span.
What is the unit of observability for an AI agent?
The session. One intent fans out into model calls, tool invocations, MCP interactions, policy executions, retries and handoffs, so a request is one leaf of a much larger tree. Instrument the tree, aggregate over sessions, and keep request-level metrics for capacity planning, where they still earn their place.
What should I check first when every request returned 200 and the answer is still wrong?
Validate the collector, send a single span with curl to confirm ingestion, then run a subtractive TraceQL query for an invoke_agent span with an execute_tool error beneath it. If that returns nothing while users still complain, the failure is not in your spans, and the next step is a synthetic session that asserts on the outcome.
Conclusion
Request-level monitoring answers whether a call worked. Agent reliability asks whether the task worked, and those are different questions with different units. The session is the unit, the span hierarchy is the map, the semantic conventions are what make the map searchable, and an outcome assertion from outside the loop is the only thing that sees a wrong answer which arrived with a 200.
Teams that want that last check running without building a probe fleet use synthetic monitoring such as Heimdall to drive a session over HTTP from outside their own infrastructure and assert on the response body rather than the status code.


