APM Instruments Deterministic Code and Agents Are Not Deterministic Code
Agent failures look like success, so monitoring must judge intent.

Traditional error monitoring fails for AI agents because a successful request can still produce an incorrect action. APM measures execution health, while agent monitoring must also evaluate whether the system fulfilled the user’s intent. The necessary change is not simply more logging, but a detection-to-fix workflow built around decisions, task outcomes, and regression tests.
Why APM was built for a world that agents don't live in
Traditional APM rests on a deterministic premise. The same inputs give the same outputs, so crashes, latency spikes, and error codes help show when execution has failed. The classic three-pillar model of metrics, logs, and traces makes these signals legible to machines. A service returns a 200 or throws an error, and monitoring records that technical outcome. Those signals remain useful, but they do not establish whether an agent chose the right action.
Agents break the assumption that one successful execution represents others. Temperature, retrieved context, tool availability, and prior memory state can change the execution path, so consecutive runs of the same prompt can invoke different tools. A happy-path trace is therefore only one observation within a distribution of behaviors. Monitoring must examine that distribution rather than treating one successful run as representative. An agent can be available, respond quickly, and be confidently wrong.
How agents fail: confident, well-formed, and incorrect
Silent, semantic failure looks technically like success. The agent produces a well-formed response or executes a valid tool call, but the outcome does not match the task. A wrong tool invoked with correct syntax need not produce a 500 or a timeout. In a CRM workflow, a duplicate record illustrates the distinction between completing an operation and achieving the intended result. Request success alone cannot distinguish the two.
Other failures are less obvious than an incorrect action. An agent may take unnecessary detours through extra tool calls and eventually return the right answer, consuming time and resources without exceeding a latency threshold. False success is more direct, as the agent asserts completion while the environment state indicates failure. Research on AppWorld coding-agent trajectories found that false success accounted for the majority of failures studied. The completion message was not reliable evidence of completion.
A 2026 longitudinal study of a production system documented five classes of silent failure, including one distinctive to LLM systems. In that class, the model transforms a failure into a fluent, plausible narrative delivered to the user. The same study found that people looking at system output eventually caught roughly 70% of silent failures, while unit tests, health checks, and governance audits stayed green through most incidents. A stronger model may write a more convincing completion summary for an action that still did not succeed.
Why teams find out from users, not from their monitors
The discovery gap follows directly from monitoring the wrong signals. If a CRM action is technically valid but produces an unwanted record, request-level monitoring has no semantic basis for identifying the problem. Repeated errors can accumulate before a user reports them. By then, the operational task is no longer just diagnosing one run, but finding the recurring pattern that monitoring never grouped into an issue.
Without that grouping, support tickets become the detection layer. Engineers then attempt local reproduction without the conversation history, retrieval results, or reasoning context that shaped the original execution. A fresh run may follow a different path, making an apparently successful reproduction inconclusive. Manual trace review offers only temporary relief. Beyond roughly a thousand daily runs, reviewing executions one by one becomes operationally impractical, leaving users to identify failures that the system could not distinguish from success.
What monitoring actually needs to capture for a non-deterministic system
The unit of analysis must shift from request to task. Agent monitoring needs to capture intent and process, including the reasoning trace, tools considered, tools invoked, arguments passed, responses returned, and latency at each hop. These observations belong in one hierarchical trace that can be replayed. Outputs alone are insufficient for this purpose. They show what the agent returned, but not the chain of decisions that produced it.
MLflow’s 2026 developer guide describes span-per-tick tracing, where each reasoning step has its own span nested under the full agent run. LLM spans capture input and output tokens, model ID, temperature, latency, and finish reason. Tool spans capture the tool name, input arguments, output payload, and execution duration. The trace also needs to include memory operations, sub-agent handoffs, and reasoning chains. This structure gives engineers a way to locate a weak step in the transcript.
Tracing alone still cannot show how well the agent did the task. Evaluation supplies that missing judgment by grading behavior against intent and the agent’s instructions. The recommended production split applies deterministic checks to all interactions and LLM-as-judge evaluation to 10–20%, with cost constraining judge coverage. Not every quality check requires an LLM. The AppWorld research found that simple linear classifiers were as accurate as fine-tuned neural models and ran orders of magnitude faster than LLM judge calls when detecting false success.
The guide places these capabilities within four disciplines. Monitoring covers system health at the agent-run level, while tracing records the reasoning and execution steps beneath it. Evaluation adds automated and human scoring against intent. Governance adds anomaly detection, policy enforcement, and audit trails.
OpenTelemetry’s GenAI semantic conventions provide an emerging vendor-neutral structure for this telemetry. They cover client, agent, and workflow spans, MCP conventions, events, metrics, and provider-specific attributes. Two essential production histograms are gen_ai.client.operation.duration for latency and gen_ai.client.token.usage for input and output token usage. The GenAI conventions currently carry status badges indicating they are still in development, so attribute names can change without a major version bump.
The operational workflow that closes the loop from detection to fix
The operational goal is a verified fix. Detection begins when automated scorers evaluate step-level traces against the agent’s instructions and identify behavior that violates the task. Recurring failures then need grouping into issues before alerting, so repeated instances become a diagnosable pattern. Slack or PagerDuty can deliver the issue where engineers already work. The alert needs enough execution context for engineers to act without reading every trace by hand.
Diagnosis follows the structure of the run. A wrong tool argument, bad retrieval, or hallucinated parameter should be located at the relevant step. When a prompt change is suspected, the comparison must isolate that variable. The same task runs against the same repo state with the old and new prompts, holding the model constant. Changing the model and prompt together makes the cause of a behavioral difference unattributable.
Transcript length, tool calls, approval count, unrelated files touched, and repeated lines of investigation can reveal a regression even when the output appears acceptable. Once engineers find the weak step, they can use the issue to make a repair and run regression testing. Microsoft Foundry supports converting production traces into reusable evaluation datasets. Amazon Bedrock AgentCore also lets teams turn production failures into regression scenarios and check improvements against locked inputs.
The repair handoff can also reach a coding agent. QueryLens, merged in October 2026, provides a concrete implementation that generates per-issue fix prompts as Markdown briefs. It exposes an MCP server at /mcp using stateless streamable HTTP, with tools including list_regressions and get_issue. That makes the diagnosed issue available to the repair workflow. Because MCP introduces an attack and stability surface, however, the tracing layer must account for it.
Verification completes the loop on the original failure. Real production failures should become evaluation cases automatically, rather than depend on engineers writing assertions after each incident. The agent is then tested against the same failure cases after the repair. This connects detection to evidence of improvement. It also gives the next prompt change a regression test derived from an actual production outcome.
How the available platforms approach the problem differently
Platform selection depends on how much of this loop a team needs the product to support. Deployment rules, framework choice, and the existing operational stack shape that decision. So does ownership of the evaluation layer. Even a platform with detailed traces needs evaluators that can spot the team’s failure modes.
LangSmith is a natural fit for LangChain and LangGraph teams. It supports production monitoring, human review, custom and LLM-based evaluators, datasets, experiments, and trajectory evaluation for multi-step agents. Failed production traces can feed regression suites, connecting diagnosis with later verification. LangSmith Studio adds an agent IDE for interactive debugging. Its relevance to this workflow is the connection between execution records, review, and repeatable experiments.
Hosting requirements create a different selection axis. Langfuse is open-source and self-hostable, with cloud tiers also available, making it an option for teams with data-residency requirements. ClickHouse acquired Langfuse in January 2026. Arize AX and Phoenix together offer framework-agnostic agent tracing, production monitoring, experiments, and evaluations, while Phoenix is open-source and self-hosted.
Datadog LLM Observability is suited to agents embedded in a broader application and infrastructure stack. It captures dynamic agent traces across model calls, tools, workflows, and retrieval, with inputs, outputs, token usage, cost, and latency. It also supports online and offline evaluations and human review. The limitation is not an inability to trace agents. Traditional Datadog error and latency monitoring alone cannot establish semantic correctness, while its LLM Observability capabilities provide a broader foundation that still needs task-relevant evaluation.
Splunk Agent Observability fits teams already using Splunk Observability Cloud. Its Python SDK integrates natively with LangChain, LangGraph, CrewAI, and the OpenAI Agents SDK, while other supported frameworks connect through OpenTelemetry. Its Luna evaluators are Enterprise-tier capabilities. Across these options, the practical comparison is whether the chosen configuration can expose decisions, score outcomes, group failures, and turn those failures into regression material.
What engineers should instrument first when moving an agent to production
The starting point should be the minimum instrumentation that exposes silent failures before users report them. For a single-step chain with one LLM call and no tools, basic logging is sufficient. Once an agent uses two or more tools in sequence, or handles more than a few dozen requests per day, step-level tracing becomes non-negotiable. Engineers should first give every tool call, LLM call, retrieval, and handoff a named span. Inputs, outputs, latency, and finish reason provide the foundation for later diagnosis.
Business context belongs in that initial instrumentation. The guide recommends tagging spans with at least user_id, session_id, and workflow_id, because adding those dimensions after an incident is painful. Automated evaluation comes next, starting with lightweight deterministic checks that the agent chose the right tool and followed policy. Deterministic checks should cover all interactions where applicable, with more costly LLM judging sampled. This converts a trace stream into a quality signal.
Failure grouping should precede alerting. An alert for every bad trace creates noise, but grouping failures that keep happening into issues gives engineers patterns they can look into. Once those patterns are established, the next layer is an automatic trace-to-evaluation pipeline. Production failures then become regression cases that can expose recurrence after a prompt change. This sequence puts diagnostic usefulness before breadth of instrumentation.
The final test is whether the system answers the right question. For agents, monitoring must ask not merely whether the system responded, but whether it did the right thing. Answering that requires a stack designed around non-deterministic behavior, task-level evaluation, and verified repair, rather than APM health signals treated as proof of success.


