All insights

AI in production

AI agent monitoring: catch regressions in production

Uptime tells you the agent answered. Quality monitoring tells you whether the answer did the work.

Co-founder and CEO, Datics AI9 min read

In brief

AI agent monitoring starts with tracing every run end to end: the prompt and its version, the retrieved context, each tool call and its result, latency, tokens and cost. Each day, sample production traces for automated scoring and a smaller set for human review. Track user signals such as edits, retries and handoffs to a person. Replay a fixed regression set on every model, prompt or configuration change, and alert when quality, cost or failure rates drift from baseline.

On this page
  1. 01What should AI agent monitoring trace for every run?
  2. 02Which user signals reveal quality problems?
  3. 03How do we score production traces without reviewing everything?
  4. 04How do we detect regressions after a model or prompt change?
  5. 05What should trigger an alert or a rollback?
  6. 06What we see in production
  7. Frequently asked questions

01What should AI agent monitoring trace for every run?

Treat one agent run as one trace, and give every step inside it its own span: each model call, each retrieval, each tool call, each permission check and each human approval. If you only log the final answer, you can see that something went wrong but not where. This is part of our larger guide, LLMOps for SaaS: keep AI features working in production.

Checklist of what to trace per agent run: identity, scope, versions, context, tool calls, human steps, cost and release.

The OpenTelemetry GenAI semantic conventions give you a shared vocabulary for most of this. They define operation names such as invoke_agent, execute_tool and chat, and conventions for retrieval spans. They also define attributes such as gen_ai.request.model, gen_ai.response.model, gen_ai.usage.input_tokens, gen_ai.response.finish_reasons and error.type. Two details matter. The conventions are still marked as in development, so names can change between versions. And capturing message content and tool arguments is opt in, because the specification treats instructions, user messages and model outputs as sensitive.

The standard describes the model call, not your product. A live SaaS agent needs product context on the same trace, or you cannot answer the questions your customers and security reviewers will ask. Here is the checklist we use for every run:

  1. 01

    Identity and scope:

    tenant ID, user role and the permission check result for every tool the agent tried to use.

  2. 02

    Versions:

    model version as returned by the provider, prompt version, tool schema version, retrieval index version and any admin configuration version.

  3. 03

    Context:

    the IDs of the documents or records retrieved, not only the text, so you can tell whether a bad answer came from bad retrieval.

  4. 04

    Tool calls:

    arguments, result status, retries and whether the call changed data or only read it.

  5. 05

    Human steps:

    whether an approval was requested, who approved or rejected it, and how long it waited.

  6. 06

    Outcome:

    task completed, handed to a person, abandoned or failed, recorded as a field rather than inferred later.

  7. 07

    Cost and time:

    tokens, model cost and latency per step and per run, so you can compute cost per successful task, not just cost per call.

  8. 08

    Feature flag and release:

    which flag variant and which deploy the run belonged to, so a regression can be traced to a change.

Cost per successful task is the number we watch most closely on the cost side. A cheaper model that fails more often and loops through extra tool calls can raise it while the cost per call goes down.

02Which user signals reveal quality problems?

Thumbs up or down is rare and not a fair sample. The stronger signals are the things users do anyway:

  • Edits to drafts. When a person approves an AI draft, measure how much they changed it. Rising edit distance on the same task type is often the first sign of drift.
  • Rejections at approval. If a step needs human approval, the rejection rate is a direct quality measure that costs nothing to collect.
  • Rephrasing and retries. A user who asks the same thing three ways in a row did not get what they needed the first time.
  • Handoffs to a person. A handoff with full context is good design. A rising handoff rate on a task the agent used to handle is a regression.
  • Abandonment. Sessions that end mid task, especially after a tool error or a long wait.
  • Support tickets that mention the AI. Tag them and join them to traces by tenant and time.

Always slice these signals by tenant, user role and task type. An average across all customers can stay flat while one large tenant quietly gets worse.

03How do we score production traces without reviewing everything?

You do not need to read every trace. Score in three layers, from cheap and complete to expensive and selective.

Code checks on every run. These are deterministic and fast. The output matches its schema, tool arguments are valid, cited sources exist, every tool call passed its permission check, no tenant boundary was crossed, the run stayed under its step and cost limits. A failure here is not a matter of opinion, so it can drive alerts directly.

Automated judges on a daily sample. An LLM judge scores a sample of traces against a written rubric: did the answer use the retrieved context, follow the business rules and do what the user asked. Draw the sample in two parts: a random slice for an honest trend line, and a slice weighted toward runs with bad user signals. Research supports the approach and shows its limits: Zheng and colleagues found that a strong model judge agreed with human preferences more than 80% of the time, about as often as people agreed with each other. They also showed position, verbosity and self enhancement biases.

Human review on a smaller set. A domain expert reviews a fixed number of traces each week, including some the judge scored well. This finds failure types nobody wrote a rubric for, and it measures whether the judge still agrees with people. If agreement falls, fix the judge before you trust its trend line.

Every trace a human labels as a failure should become a candidate case for your regression set. That is how monitoring and testing feed each other.

04How do we detect regressions after a model or prompt change?

Keep a fixed, versioned regression set: real cases drawn from production (de-identified or synthetic where the data requires it), each with what good looks like. Start with a few dozen cases that cover your most common and most expensive task types, and add every production failure you fix.

Five steps to catch regressions: a versioned case set, replay on each change, compare per slice, flag release, track model.

Replay the set on every change that can alter behavior, not only code deploys:

  • a new model version, or a provider update to the version you use
  • a prompt or system instruction change
  • a tool schema or API change
  • a retrieval index rebuild or a change to the source documents
  • an admin configuration change, if customers or staff can edit scripts, rubrics or instructions

Compare results against the baseline per case and per slice, not only as an overall average. A version that scores better on average while failing three cases it used to pass has still regressed, and those cases are often the ones a customer will notice.

After the set passes, release behind a feature flag to a small group of tenants and compare live signals between versions for a few days before widening. Record gen_ai.response.model on every span, and if it changes without a release on your side, run the regression set. This is not hypothetical: a Stanford and Berkeley study found that the behavior of GPT-3.5 and GPT-4 changed substantially between their March and June 2023 versions.

05What should trigger an alert or a rollback?

Not every quality dip deserves a page. Google's SRE workbook gives a useful pattern: alert on how fast you are burning an error budget, not on single bad events. Its recommended starting points page on 2% of the budget consumed in one hour (a burn rate of 14.4) or 5% in six hours, and open a ticket on 10% consumed over three days. We apply the same idea to agent quality, with one exception: boundary and safety failures page on the first occurrence.

The thresholds below are starting points we tune against each product's own baseline after the first weeks of traffic. They are not benchmarks.

SignalHow to measureStarting thresholdAction
Permission or tenant boundary violationCode check on every runAny single occurrencePage; turn the capability off by feature flag; review the audit log
Tool call failure rateFailed tool spans over all tool spansFast burn: 2% of the monthly error budget in one hourPage; roll back the most recent change
Output schema or citation failuresCode check on every runTwice the trailing seven day rate for one hourPage; check the latest prompt, model or tool schema change
Regression set pass rateReplay on every changeAny critical case that used to pass now failsBlock the release
Judge quality scoreDaily sample against a rubricBelow baseline on two consecutive days, overall or in one sliceTicket; human review of the low scoring traces
Human rejection, edit or handoff rateImplicit signals per task type1.5 times the trailing baseline for a full dayTicket; sample and review
Cost per successful taskCost over completed tasks1.5 times baseline over 24 hoursTicket; look for loops, longer context or a model change
Latency at the 95th percentileSpan timings per runBurn rate on your latency objectivePage or ticket by burn rate
Provider model changegen_ai.response.model differs from the pinned versionAny changeTicket; run the regression set

Decide the rollback path before you need it. The fastest safe rollback is usually a feature flag that returns users to the previous version or the workflow they had before the agent, not a redeploy.

Most of these checks answer the reasons AI agents fail in production.

06What we see in production

Three patterns from our own work, with the clients kept anonymous.

A scoring agent is itself an agent you have to monitor. An insurance sales training business wanted its agents to practice voice calls with an AI prospect and get consistent scoring against its own checklist, instead of uneven feedback from one coach to the next. Later it wanted real sales calls scored like practice calls. We started with a short proof of concept with hard coded scenarios, then moved scripts, scenarios, checklists and global AI instructions into the database so admins control the AI. Feedback runs as a LangGraph workflow of small steps.

Every admin edit to a script or checklist changes behavior just as a deploy does, so configuration versions belong on the trace and in the regression scope. And a fixed checklist rubric makes the score itself something you can trend and audit.

A deterministic anchor makes drift visible. A founder building an automated claim checking product had a prototype with no database, cache, API or audit history, and no labeled data to measure its accuracy. We began with a gap analysis before writing code. We kept rule based pattern matching as a fast, explainable anchor, added semantic embeddings, and limited the LLM to suggestions with a confidence value, merged through calibrated weights. We also designed a signed audit trail for every claim. When an explainable layer runs beside the model, disagreement between the two becomes a measurable signal.

Knowledge changes are behavior changes. For a cloud storage product, we built an assistant inside the team chat tool that answers product, pricing and FAQ questions from the company's own wiki and pricing content. It returns a stored FAQ before any model call. An assistant like this can drift when the knowledge changes, even if the model does not, which is why we trace retrieval index versions alongside model versions.

On an agent we built that turns company data into internal apps, the deployment package traces agent runs with OpenTelemetry and Langfuse, and each organization's model choice is recorded in an append-only audit log.

Across this work, one rule holds. As our co-founder and CTO, Rana Umar Majeed, sets out in why AI agents fail in production, control has to rise with capability as an agent moves from read and recommend to prepare, modify and execute. Monitoring follows the same ladder: an agent that only reads can be sampled lightly. One that changes customer data needs every run checked by code, human approval where the risk calls for it, and a replayable audit trail.

Frequently asked questions

Does OpenTelemetry work for LLM tracing?

Yes. The GenAI semantic conventions cover model calls, agent invocations, tool execution and retrieval. They are still in development, so pin your instrumentation version and expect renames. You will still need your own product attributes, such as tenant, role, prompt version and outcome.

How do we monitor quality when there is no ground truth?

Combine reference free checks. Code checks catch format, citation and permission failures without a correct answer. A rubric based judge, checked regularly against people, scores whether the agent followed instructions and used its context. Implicit signals such as edits, rejections and handoffs show whether the output did the work. Weekly human review builds labeled examples, which become the ground truth for your regression set.

What do we do when a model provider updates a model?

Pin a dated model version rather than an alias, and record the model the provider actually returned on every span. When a new version is announced, run your regression set against it, compare quality, cost and latency by slice, then release it behind a feature flag to a few tenants. Keep the previous version available until you are confident or until the provider retires it.

How long should we retain traces with customer data?

As short as debugging and evaluation allow, set per data type. Metadata such as timings, token counts, versions and outcomes can usually be kept longer than message content. Redact or tokenize personal data before storage, and keep regression cases as de-identified or synthetic copies. Your customer contracts and data processing terms set the outer limit.

How Datics helps

Datics specializes in brownfield AI: bringing production AI into the product you already operate, without forcing a rebuild.

›References (4)
  1. OpenTelemetry semantic conventions for generative AI client spans
  2. Google SRE Workbook: Alerting on SLOs
  3. Zheng et al., Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena (arXiv)
  4. Chen, Zaharia and Zou, How is ChatGPT's behavior changing over time? (arXiv)

Related work

Case studies from our projects on the same subject.

Cosmic AI

Financial Services · Multi-agent investing assistant

Retail investors go from research to a confirmed order in one conversation

Investors juggled data, news and a separate broker. Now agents research and prepare each trade in chat, and nothing is placed until they confirm.

Agentic workflowsAI-native productHuman approval
Read case study

CleanHaus

Real Estate & Hospitality · Turnover operations SaaS

Hosts and cleaners manage rental turnovers in chat, within each person's permissions

Owners, managers and cleaners all talk in one property chat. Now an AI there acts for each of them, only within that person's role.

Brownfield AIAgentic workflowsPermission-aware
Read case study

SovrenAI

B2B Software · Enterprise Builder, an AI internal app builder

Internal apps built on company data, with a person confirming every guessed join

An agent writing queries over unknown schemas can join the wrong tables; here every guessed join waits for a person to approve it.

AI-native productAgentic workflowsHuman approval
Read case study

Your customers already expect AI from your product.

Let us make it real without rebuilding what already works.