AI agent monitoring: how to catch failures that never throw an error
AI agent monitoring for failures that never throw an error: what to watch, how detectors judge production traces, and how Signals lead to the root cause.
On this page
Most AI agent monitoring starts from the tools built for ordinary software: error rate, latency, cost, uptime. An agent can pass all four and still tell a customer something that is not true.
Here is one run from our demo support agent, which answers synthetic customers for a fictional outdoor gear shop. A customer wrote:
Where is A-48347? If it won't arrive this week, I want my money back.
The agent looked up the order, checked tracking, searched the help center twice, opened a support ticket, and replied:
I checked the return policy: items can be returned within 30 days of delivery in original condition. Since the order is still in transit, I haven't issued a refund. If it arrives and you'd like to return it, contact us within that window.
It reads like a careful answer. The run took 15.2 seconds, cost $0.00082, and every span completed. Nothing in it would move a chart.
The help center article the agent retrieved says one thing about returns: "Items can be returned within 30 days of delivery in original condition." It says nothing about orders that have not arrived. The agent turned a return window into a rule that an order in transit cannot be refunded, and refused the customer on the strength of it.
This post is about monitoring an AI agent's behavior in production, using the traces it already produces: what to monitor, how a detector judges live traces, how flagged traces become one problem you can track, and how to get from that problem to its cause in your code.
The two layers of AI agent monitoring
AI agent monitoring has two layers, and a production agent needs both.
The operational layer: is the agent running well? This is latency, cost, token usage and error rate. A dashboard shows all of it at a glance, and an alert posts to Slack when a number crosses a threshold you set. It is quick to set up and quick to read. In our demo project, one alert watches p95 latency on customer lookups and another watches hourly spend on the larger model. They are what catches a removed cache or an accidental switch to a more expensive model.
The behavioral layer: is the agent doing the right thing? This layer covers wrong answers, skipped steps and requests left unresolved. It takes more work than the first layer. The input space has no edges, because a support agent accepts any sentence a customer can type. The same input does not always give the same output, so a prompt that held up in testing can drift after a model change that looked harmless. And quality lives in the content: a run went well only if the answer matches what the tools returned. Both are recorded in the trace.
The run at the top of this post belongs to the second layer. Its numbers were normal, and the problem was in what the agent said. The rest of this post covers that layer: how to read each trace and judge what happened in it.
What to monitor in an AI agent
A quality score from 1 to 5 is hard to act on. A yes-or-no question about one specific event is easy: you can filter on it, count it, and send it to the person who owns it. So the first step is to write down the events that mean something went wrong, one question each.
There are two places to look.
The agent's side of the trace. These are failures you can see in what the agent did, whether or not the user noticed. We cover these in more depth, including tool failures, hallucination, logic errors and task completion, in the six LLM evaluation metrics that matter for AI agents in production.
| Event | The question to ask of each trace |
|---|---|
| Ungrounded answer | Does the final answer state a policy, number or rule that appears in no tool result? |
| Silent tool failure | Did a tool return empty or null where it should have had data, and the agent carried on? |
| Skipped step | Did the agent take an action that requires a check, without the check? |
| No progress | Did the agent repeat the same tool call, or hand the conversation back to an agent that already had it? |
The user's side of the conversation. Users tell you when something failed, in their next message. Four events are worth checking in any conversational agent.
| Event | The question to ask of each trace |
|---|---|
| Frustration | Does the last user message contain profanity or strong frustration? |
| Disagreement | Does the user say the previous answer was wrong, or that the steps did not work? |
| Out of scope | Is the user asking for something the system prompt does not cover? |
| Insufficient answer | Is the user asking again, or asking for more detail on what they already asked? |
The two lists catch different things. The refund refusal above would never show up on the user's side if the customer simply left. It shows up on the agent's side, because the answer contains a rule the trace does not support. You do not need all eight on day one. Start with the two or three events that would cost you most if you missed them, then add detectors as you see what your agent actually gets wrong.
Let a detector judge your production traces
Monitoring behavior takes four steps: record each run as a trace, judge the traces, group what gets flagged, and find the cause.
In traceroot, each of those questions becomes a detector. A detector is a prompt, a judge model, a filter and a sampling rate. After a trace finishes, the judge model reads it and answers yes or no, with a one-sentence summary.
The judge reads the whole trace: every span, with its inputs and outputs, including what each tool returned. That is what makes the first table above checkable. "Is this claim grounded?" can only be answered by something that sees both the claim and the help center result.
The detector that caught the refund refusal is called "Ungrounded policy answers". Here it is in traceroot:
This is the core of its prompt:
Report identified=true only if the final answer states a specific policy
fact (a number, a time period, a benefit or a rule) that is grounded
nowhere in the trace. This includes answers given after search_help_center
returned no articles. Do not flag answers that say the information could
not be found, polite filler such as "you should see the funds soon", or
offers to help further.
Two things in it are worth copying. It names what counts as evidence, and it lists what not to flag. A detector that flags traces with nothing wrong in them gets noisy, and a noisy detector gets ignored. Once it is ignored, its good judgments are ignored with it.
On the run above, the judge answered yes and wrote:
The final answer implies an unsupported rule that an in-transit order cannot be refunded, while the help-center results do not establish that restriction.
The outlined row is the judge's verdict on this trace.
You can type a prompt like the one above into Detectors → New Detector, or describe the detector to the traceroot Agent on the Home page and review its draft.
You do not have to judge every trace
Judging costs a model call per trace, so two settings control how many traces a detector reads.
- Sampling. A new detector checks 25% of matching traces. The demo detector above is set to 100%. Raise it to 100% for a rare, costly event such as a refund issued without review. Lower it for a common one where a rate is all you need.
- Filter. Limit a detector to the traces where its question makes sense: one environment, one model, or traces above a cost or latency threshold.
The judge model is your choice per detector. It can be a model traceroot provides or one from your own provider key.
One problem instead of forty traces
A detector that works produces a new problem: a list. Eight flagged traces this week, forty next week, each with its own summary. Reading them one by one is the same work as reading traces, moved one step along.
traceroot groups a detector's flagged traces into Signals. A Signal is one problem the agent keeps running into. Each new flagged trace either joins the Signal it belongs to or starts a new one, and the grouping follows a simple test: a Signal is the set of flagged traces that one change would remove.
The refund refusal joined a Signal named "States facts not established by the available evidence". Over the past seven days it covered 8 of the 445 traces the detector checked. The other traces in it look different on the surface:
- The agent told a customer a refund "was sent to the original payment method", a refund rule that appears in no tool result.
- The agent said standard shipping takes 3 to 5 business days "after shipment", when the help center article says only "3-5 business days".
- The agent promised that tracking "should provide an estimate" once an order ships.
A refund question, a shipping question and a tracking question, with one thing in common: the agent adds a detail the evidence does not contain. Seen as eight separate traces, each is a small slip. Seen as one Signal, it is a behavior with a rate: 2% of conversations this week.
A Signal has a state, and the state is what turns a list into a workflow:
- Open. The problem needs attention. Every new Signal starts here.
- Resolved. You fixed it. If a flagged trace arrives from a run that started after you resolved it, the Signal reopens by itself, so a regression does not need anyone to remember the original problem.
- Dismissed. No action needed, for example expected behavior. A dismissed Signal stays dismissed.
Notifications follow Signals. traceroot sends an email or Slack digest when a Signal is created or reopened, and stays quiet when an already announced Signal collects more traces. You hear about a problem once.
From a Signal to its cause
Knowing that 2% of answers contain an invented detail is progress. The next question is why, and for an agent the answer usually sits in three places at once: the trace, the code, and what changed recently.
traceroot's agent runs one root cause analysis per Signal. It reads one of the Signal's traces. With GitHub connected, it also clones your repository at the relevant commit into an isolated sandbox and reads the code and recent commits. This works because every trace carries git context: the repository, the commit, and the source file and line of each instrumented function. The quality of the analysis comes from that full context, where a judge alone only has the trace.
For the Signal above, the analysis read the shipping-times trace and reported:
- Root cause. The model added a condition that is not in the retrieved help center article, even though the system prompt tells it to state policy only as the help center gives it.
- Code location.
support_agent.py:355, the base rules in the system prompt. It also noted that the tool span's own source line was "generic plumbing and not causal": the retrieved evidence was correct, and the detail was added at the generation step. - Recent changes. A commit had already added the grounding rule to the prompt. A later commit moved the sub-agents to a smaller model with reasoning turned off. The analysis read this as a regression that surfaced after the model change.
- Recommendation. Tighten the rule so it forbids adding conditions that are not literally in the article, or raise the reasoning effort for the final answer step.
Root cause analysis that traceroot generated for this Signal.
That is a different kind of output from "hallucination detected". It points at a line, names the commit that likely changed the behavior, and proposes something an engineer can accept or reject in a minute.
If you want to go one step further, you can ask the agent to write the change. With the GitHub integration set up, it can optionally implement a fix on a new branch and open a pull request for your review. It never pushes directly to your default branch.
Close the loop
A fix is a claim until it is tested. Two habits keep monitoring from becoming a list of things you once looked at.
Keep the traces that taught you something. A flagged trace can be added to a dataset from the trace panel. The refund refusal makes a good test case: the same customer message, and a clear expectation that the agent does not invent a rule. We wrote about testing a fix against a recorded case.
Let the Signal tell you whether it worked. Resolve the Signal when the fix ships. If it stays resolved, the fix held on real traffic. If it reopens, the next flagged trace tells you before a customer does.
How to start monitoring your AI agent
Monitoring of this kind needs traces that contain the content of each step: the messages, the tool arguments and the tool results. Timing and status alone would not have caught anything in this post.
To send traces from a Python agent that uses OpenAI:
pip install traceroot openai
from openai import OpenAI
import traceroot
from traceroot import Integration
# This single line instruments all OpenAI API calls
traceroot.initialize(integrations=[Integration.OPENAI])
client = OpenAI()
Set TRACEROOT_API_KEY in your environment, and in production set TRACEROOT_GIT_REPO and TRACEROOT_GIT_REF so each trace carries the commit it ran on. The tracing guide covers TypeScript and the other integrations.
Then create one detector. If you are not sure which, start with the question whose wrong answer would cost you most, set a sampling rate that fits your traffic and budget, and read what it flags. traceroot is open source and self-hostable, so you can run it on traceroot Cloud or on your own infrastructure.
FAQ
What is AI agent monitoring?
AI agent monitoring is the practice of watching a production agent on two layers: how it runs (errors, latency, cost) and how it behaves (wrong answers, skipped steps, unresolved requests).
Is a dashboard enough to monitor an AI agent?
For the operational layer, yes. A dashboard and a few alerts cover latency, cost and errors. For the behavioral layer you also need something that reads each run, such as a detector. An agent that answers confidently from a rule it invented completes on time and at normal cost.
Do I need to evaluate every production trace?
No. Sample by how rare and how costly the event is. Check every trace for events you cannot afford to miss, and a fraction for common events where you only need the rate. Filters narrow a detector further, for example to one environment.
How is a detector different from an alert?
An alert watches a number over a time window, such as p95 latency or spend per hour, and fires when it crosses a threshold. A detector reads one trace and answers a yes-or-no question about it. Most teams need both.
What should I do with a flagged trace?
Look at the Signal it belongs to before the trace itself. The Signal tells you how often the problem occurs and whether it is new. Then read the root cause analysis, decide on a change, add a representative trace to a dataset, and resolve the Signal when the fix ships.



