Latency Outlier Detection in Agentic Tool Call Chains
Slow tool calls often trace back to earlier faults, so only full-chain traces reveal them.

Latency outlier detection in agentic tool call chains requires full-chain traces. AI observability platforms can automatically group agent failure patterns that recur by comparing tool calls, chain positions, return payloads, and downstream effects across runs. The diagnostic unit is the repeated failure signature, because the slow step may be several calls downstream from the actual fault.
Why latency outliers in tool call chains are diagnostic signals, not performance noise
An agent’s uptime dashboard is green, its token count looks normal, and it is silently looping. Every request can succeed at the transport layer while the task takes an unnecessary turn. Traditional APM records HTTP response codes, CPU, and error rates, but those signals do not reveal whether an agent repeated a step, waited on a hallucinated tool result, or propagated bad output through six downstream calls.
That distinction follows from how an agentic request expands. Each request becomes a chain of interdependent LLM calls whose prompts incorporate earlier outputs and tool results. XPerf found that the number of calls varied widely for identical requests on the same agent, even with a fixed seed. OSWorld-Human found that the highest-scoring agents took between 2.7× and 4.3× more steps than required. Extra steps add to latency before any one call becomes unusually slow, so diagnosis must account for how the chain behaves.
How the chain structure turns a single stall into a cascade
A logistics company’s supply chain routing agent began choosing the wrong routes after a downstream API changed one field name. The field incident_count became num_incidents, but the agent’s tool schema was not updated. Subsequent decisions were built on missing context. No error log fired, and the system reported all-green until a human noticed the drift in outcomes. The failure was not a rejected request but an accepted result that no longer supplied the expected information.
The serial ReAct loop explains how such a defect spreads. Each reasoning step completes before the next tool call starts, and that tool call completes before reasoning resumes. A bad output therefore becomes input to the next decision. An API returning HTTP 200 with an empty array or null value raises no exception, so the monitoring layer can record success while the agent continues with missing information. Downstream calls may stay syntactically correct even as their results get more and more wrong.
The resulting latency signal can appear well after the defect. An outlier at step N may originate in a failure at step N-3, making the slowest span a symptom. Per-call timing cannot reconstruct that relationship on its own. Useful instrumentation must connect the late stall to the earlier result and the prompts that consumed it.
Where latency actually lives in an agentic chain, and why the answer varies
DynAMO’s 2026 study found that LLM inference and orchestration accounted for the great majority of latency in asset-management workflows, with tool I/O contributing a small share. A 2026 characterisation of ten agentic applications found tools and environments dominating or co-dominating latency in five of them. The findings differ because they come from different workloads. Web latency alone accounted for just over half of total runtime in one measured web-agent workload. An inference-only view would miss that source of delay entirely.
The OSWorld-Human study found that steps near the end of a computer-use task could take up to roughly three times longer than early steps because each prompt included the history of previous steps. A late call’s duration reflects the accumulated context as well as the work requested at that moment.
A stateful-inference study further showed how prefix handling changes those costs. It reported 2.1× lower per-turn latency than baseline engines by reusing a growing prefix rather than re-prefilling it, with the advantage widening to 4.2× on the median turn of a long coding workflow. Raw duration cannot identify that mechanism. Without chain position, context size, and dependency structure, monitoring cannot distinguish an anomalous call from an expected increase in processing time late in a task.
What full-chain tracing must capture to surface a latency outlier's root cause
A full-chain trace needs a parent span for the agent task and child spans for its steps, with LLM and tool calls recorded in that structure. The hierarchy makes task-level queries possible. Instead of returning every call above a duration threshold, a query can return every task containing an unusually slow step. That preserves the surrounding execution, showing the delay’s origin in the step itself or in earlier steps.
Tool spans must record the tool name, arguments, and result alongside elapsed time. An empty array and a populated result can both arrive successfully, but their consequences differ. Chain position must also be available on every span. A 400ms tool call at step 2 and a 400ms call at step 18 have different contexts, even though a duration histogram treats them the same. Recording the result lets a detector link changes in timing to data that is missing or has changed.
Context token count supplies another required dimension. When the count grows faster than expected between steps, it can reveal a loop that a call-duration threshold would miss. Dependency edges must then show which tool result fed which subsequent prompt, allowing an investigation to move backward from the delayed step to the originating failure. The OpenTelemetry GenAI project under CNCF defines conventions including invoke_agent, chat, and execute_tool spans. Those conventions provide a shared vocabulary, but the trace still needs the content and relationships that make causal investigation possible.
How major agent frameworks emit (or fail to emit) the spans that make chain-level detection possible
OpenAI Agents SDK traces runs by default, collecting LLM generations, tool calls, handoffs, and guardrails for its Traces dashboard. Processors can fan traces out to external collectors, while OPENAI_AGENTS_DISABLE_TRACING=1 disables tracing. Its default structure approaches the required hierarchy. But it does not automatically record context token counts for each step, so it lacks the data needed to compare how prompts grow.
LangGraph provides a different part of the investigation workflow through persistent state. LangGraph 1.0 stabilized its checkpointing API in October 2025, and LangGraph 1.2.0 hardened persistence APIs further in May 2026. Production teams use PostgresSaver or RedisSaver, both implementing BaseCheckpointSaver, to persist state in PostgreSQL or Redis. Persistence alone is not chain-level tracing. Linking the saved checkpoint to an OpenTelemetry span attribute lets a team recover chain position and use replay when looking into an incident.
LangChain and LangGraph over HTTP introduce another boundary. The November 2026 instrumentation challenge is to collect HTTP metadata without consuming a streamed body, exposing credentials, or losing the link to the logical agent step. Both layers need instrumentation and an explicit correlation identifier. The framework trace provides application semantics, and the HTTP client provides wire-level metadata. Joining them makes the transport event interpretable within the agent’s chain.
Across these frameworks, a successful span alone does not show that the result is semantically valid. None automatically flags every empty or null tool payload as an anomaly. Teams must add that check explicitly. Otherwise, the trace can faithfully record a successful call while missing the event that starts the cascade.
How do AI observability platforms detect and group repeated latency failure patterns across agent runs?
Meaningful detection compares like-for-like steps rather than applying one duration threshold to every run. XPerf’s finding of substantial call-count variance explains why a simple P99 threshold can fire on ordinary execution differences. Baselines need chain position and context size. A step that is slow relative to comparable runs is more informative than one that is merely slow relative to the entire population. The comparison must preserve the workload’s structure.
A sharp drop in return payload size can reveal the empty-array pattern, while context tokens that grow faster than they have in the past can reveal repeated reasoning. PASTE found stable application-level control flows across the deep research, coding, and scientific-agent workloads it tested. Recurring tool-call sequences therefore provide another baseline. A departure from the expected sequence can indicate a cascade even before duration becomes exceptional.
Lacuna found that token log-probabilities and sampling consensus performed near chance for hallucinated tool calls because the model was confidently wrong. The same paper found attention-graph spectral analysis more effective as model scale increased, with a Fast-Fiedler approximation reducing detection latency. Duration alone is therefore insufficient. The appropriate detector depends partly on the model and failure mode as well as the chain.
Automatic grouping of recurring AI agent failure patterns connects these signals across runs. A failure signature can combine the tool, chain position, payload anomaly, sequence deviation, and downstream effects, exposing a repeated origin. Grouping changes the object of investigation. An alert on the grouped issue lets a team look into the structural defect without reading every trace by hand, while keeping the individual runs needed to see its effects.
Using latency outlier patterns to inform speculative execution and reduce cascades proactively
Stable tool-call sequences support prevention as well as detection. PASTE’s March 2026 paper demonstrated a roughly half reduction in average task completion time and a near-double improvement in tool execution throughput on production agent workloads by pre-executing likely tool calls during LLM thinking time. It did not require changes to the model, prompts, or individual tool latency. The gain came from reducing serial waiting. The same recurring sequences used to detect deviations supplied the basis for anticipating work.
That connection makes speculation a natural extension of full-chain instrumentation. Its pattern table is built from production traces, so the monitoring data also provides input for speculative execution. Where likely calls can run in parallel, a stall need not impose the same sequential wait on later work. This limits the delay amplified by serial execution. It does not establish that the resulting data is correct.
A speculated call can still return an empty payload or a hallucinated result. If downstream reasoning consumes that result as valid, the semantic failure remains even when execution is faster. Speculation addresses the latency consequence of serial chains, while monitoring addresses the diagnostic consequence of silent failures. The two techniques are complementary, not substitutes.
Closing the loop from outlier detection to verified fix without hand-writing assertions
Tool names, arguments, return payloads, chain positions, and downstream effects give a coding agent the evidence needed to propose a fix. Passing that context over MCP is more precise than a bug report describing only the visible slowdown. The trace preserves the causal path. The proposed change can then target the originating defect.
Decagon’s Duet Autopilot demonstrated this loop in customer support in June 2026. It analyzes production conversations, traces failures to root causes in the agent’s operating procedures, and proposes fixes. It then tests each fix against the original conversation and a curated golden test set of hundreds of conversations before human review. The loop does not require manual assertion authoring. Its verification starts from the production example that exposed the failure and extends to other conversations.
To diagnose latency, that regression step must keep the whole chain in view. An online eval built from the real failure patterns behind the alert can expose a new outlier at another chain position that a unit test on the repaired function would miss. The operational test for AI-native monitoring is whether it can identify which tool call, at which position, in which recurring run pattern originated the cascade, then verify the fix across production inputs. Without both capabilities, detection ends before resolution.


