1. Blog
  2. How to Monitor AI Agents in Production: Traces, Evals and SLOs
Blog

How to Monitor AI Agents in Production: Traces, Evals and SLOs

Record each agent run as one trace with a span per step, test new versions with evals before release, and set SLOs with burn-rate alerts. Here's how.

The Atatus TeamPublished December 4, 202610 min read
How to Monitor AI Agents in Production: Traces, Evals and SLOs

To monitor AI agents in production, record each run as one trace with a span for every step: each model call, tool call and retrieval, with its duration, tokens, inputs, outputs and errors. Test every new version against a fixed set of cases before release, and set service level objectives (SLOs) for how often runs succeed and how long they take. Then alert on how fast failures use up the error budget, not on each failed run.

Done this way, a user's report of a slow or wrong answer leads you straight to the step that caused it, instead of a guess from the final output. This guide covers why agents fail differently from ordinary code, what to record for each step, how to test quality before release, how to set SLOs and burn-rate alerts for agents, and how to do it with Atatus LLM observability.

Table of Contents

Why AI agents fail differently

An agent works in a loop: the model reads the task, picks a step, calls a tool or another model, reads the result and decides again, until it answers or reaches a limit. That loop is what makes agents useful, and it is also what makes them hard to run in production:

  • The path changes from run to run. The model picks the tools and their order, so two runs with the same input can take different paths. Testing one path tells you little about the others.
  • One answer, many steps. A single run can make several model calls, tool calls and retrievals. When the answer is slow or wrong, the cause is usually one step, and the final output doesn't say which.
  • Tool failures don't always stop the run. A tool that times out, returns an error message or returns nothing hands that result back to the model, which may carry on and give a confident wrong answer.
  • Loops. An agent can repeat the same tool call or keep re-planning until it reaches its step limit, adding time and tokens with every turn.
  • Failures that look like success. A wrong answer, a refusal or output in the wrong format all come back as a normal response.
  • Behavior changes without a deploy. A prompt edit, a new tool, different retrieved data, or a model alias that now points to a newer model version can change results with no code change.

Trace every run: one span per step

The unit to monitor is the run. Record each run as a trace, with a parent span for the run and a child span for each step, so the steps appear in order with their timing. When steps run in parallel, such as two tool calls at once, their spans overlap in time under the same parent.

StepWhat to record
The run (agent or workflow)Agent name and version, the input, the final output, the outcome, the number of steps, total tokens and end-to-end duration
Model callProvider, the model requested and the model that answered, input and output tokens, finish reason, duration, and time to first token when the answer is streamed
Tool callTool name, arguments, the result or error, and duration
RetrievalThe query, how many documents came back and which ones, and duration

Add the context you will want to filter by: the release, the prompt version and the feature that started the run. Put user and session IDs on trace attributes, where you can search by them, rather than on metric labels, where every new value creates a new time series. High cardinality explains why.

Keep the agent's trace joined to the request that started it. Tools usually query a database or call an API, and when those calls sit in the same trace, a slow tool is easy to tell apart from a slow model.

Track tokens and steps per run

Most model APIs bill by the token, so token counts are your earliest cost signal, and a change in them is often the first sign that behavior changed. Track them per run, not only per call:

  • Tokens per run, split by agent, model and release. A jump after a release usually points to a longer prompt, more retrieved context or extra steps.
  • Steps and tool calls per run. A rising count is the clearest sign of loops and re-planning.
  • Input tokens per model call across a run. Most agents send the conversation so far with each model call, so input tokens grow with every step, and long runs can reach the model's context limit.
  • Stops at a limit. Count runs that end at the step limit or the maximum output tokens as failures, even though no error was raised.

For the per-call details, such as reading token counts from the OpenAI and Anthropic SDKs, see how to monitor LLM calls in Python.

Test quality with evals before each release

Latency and error rate can't tell you whether an answer was right. Evals can. An eval runs the agent on a fixed set of cases and scores each result, so you can compare a new version with the current one before users see it.

  • Build the dataset from real runs. Take cases from production traces, remove personal data, and write down what a good result looks like: the tool that should be called, facts the answer must contain, or a reference answer.
  • Use the cheapest check that works. Code checks (was the right tool called, is the output valid JSON, does it contain the order number) are fast and repeatable. Use a model as a judge for open-ended answers, and compare its scores with human ratings from time to time.
  • Gate the release. Run the dataset in CI, and fail the build when the pass rate drops or a case that passed on the last good version now fails.
  • Keep scoring after release. Run the same evaluators on a sample of production runs, to catch drift that the dataset doesn't cover.

A release gate can be a short script. This one assumes your agent's entry point returns the answer and the list of tools it called:

import json
import sys

from my_agent import run_agent  # your agent's entry point

MIN_PASS_RATE = 0.9  # set this from your own history


def passes(case, result):
    expected_tool = case.get("expected_tool")
    if expected_tool and expected_tool not in result["tools_called"]:
        return False
    must_contain = case.get("must_contain")
    if must_contain and must_contain not in result["answer"]:
        return False
    return True


with open("evals/cases.jsonl") as f:
    cases = [json.loads(line) for line in f if line.strip()]
with open("evals/last_passing.json") as f:
    baseline = set(json.load(f))  # case IDs that passed on the last good build

ids = {case["id"] for case in cases}
passed = {case["id"] for case in cases if passes(case, run_agent(case["input"]))}
regressions = sorted(baseline & (ids - passed))
pass_rate = len(passed) / len(cases)

print(f"Pass rate: {pass_rate:.0%}. Regressions: {', '.join(regressions) or 'none'}")
if regressions or pass_rate < MIN_PASS_RATE:
    sys.exit(1)

Agents don't give the same answer every time, so run a failing case more than once before you block a release over it. When a build passes, save its passing case IDs as the new baseline.

Set SLOs for success rate and latency

A service level objective (SLO) is a reliability target for a service over a period, such as 30 days. For a user-facing agent, two are usually enough:

  • Success rate. The share of runs that finish without an error, without stopping at a step or token limit, and with output that passes your validation. For example, 99% of runs succeed over 30 days.
  • Latency. The share of runs that finish within a time your users accept, measured end to end. For a streamed chat answer, track time to first token as well. For example, 95% of runs finish within 20 seconds.

The gap between the target and 100% is the error budget. A 99% success SLO lets 1% of runs fail: at 40,000 runs in 30 days, that's 400 failed runs. The burn rate is how fast you are using that budget. At a burn rate of 1, the budget runs out exactly at the end of the 30 days. At 14.4, one hour uses 2% of the month's budget, and the whole budget is gone in just over two days.

Alert on the burn rate, not on single failures. Every agent fails now and then, and a page for each failed run teaches people to ignore pages. The Google SRE Workbook suggests these starting points for a 30-day SLO. Each one also checks a short window, so the alert clears soon after the problem stops:

  • Page when the burn rate is above 14.4 over the last hour and the last 5 minutes.
  • Page when it is above 6 over the last 6 hours and the last 30 minutes.
  • Open a ticket when it is above 1 over the last 3 days and the last 6 hours.

Catch anomalies and find the root cause

Some problems never cross an alert threshold: a tool that gets a little slower every day, a release that adds two steps to each run, or a model update that makes answers longer. Compare tokens per run, steps per run, tool error rates and step latency with their own history, and check them before and after every deploy, prompt change and model change.

When an alert fires, start from a failed or slow run rather than a dashboard. The trace shows which step failed or took the time, and filtering by tool, model and release tells you whether it is one bad run or a pattern. AI anomaly detection in observability covers baselines in more depth, and AI SRE explains how AI-assisted incident investigation works and how to check the root cause it proposes.

What AWS added for agents around re:Invent 2026

Around AWS re:Invent 2026, Amazon CloudWatch added several features for AI agents. On November 29, AWS announced observations for CloudWatch in preview: CloudWatch learns what normal looks like for each service and AI agent, groups related anomalies, and ranks them by how much of the system is at risk. On December 1, CloudWatch Omni added agent experiments, agent cost estimates in preview, and SLOs. Experiments test a new agent version against your datasets and evaluators and return a pass or fail verdict before release, and SLO burn-rate and error-budget alerts can start an investigation. These are the same building blocks this guide covers: traces of every step, evals before release, and SLOs with burn-rate alerts in production.

How to monitor AI agents with Atatus

Atatus LLM observability records agent runs in Python apps, from Python agent 2.1.0. You don't wrap each step yourself: the agent instruments LangChain and LangGraph, LlamaIndex, CrewAI and the MCP Python SDK, along with the model clients they call, such as OpenAI, Anthropic, Amazon Bedrock and Vertex AI.

  1. Install the agent with the llmobs extra:
    pip install "atatus[llmobs]"
  2. Turn on tracing and LLM monitoring. Set TRACING and LLMOBS to true in your Atatus config, or set the environment variables ATATUS_TRACING=true and ATATUS_LLMOBS=true. Both are off by default. How to monitor LLM calls in Python shows the setup for FastAPI, Django and Flask, and which library versions are covered.
  3. Restart the app and run the agent a few times.

Then open LLM in the Atatus menu:

  • LLM Traces lists spans with their content, name, total tokens and Kind: agent, workflow, task, tool, chat or completion, so you can tell the steps of a run apart. A selector switches between LLM Spans and All spans.
  • Opening a trace shows an LLM tab with the duration, total tokens, LLM calls, model name and provider, kind and total cost, followed by the input and output messages. The Trace view tab shows every span in the trace. When the agent runs inside a web request, that includes the request's database queries and HTTP calls, so a slow tool is easy to tell apart from a slow model.
  • Overview lists each project with its trace count, error rate and tokens, and Explorer shows error rate, p95 trace duration, token usage, LLM calls and estimated cost for the selected time range, filtered by project, model provider and model.

Because the agent runs inside your service, Atatus APM also measures the service's response time and error rate, and alert rules can fire on both.

Prompt and response text is recorded by default. To keep it out of Atatus, set TRACELOOP_TRACE_CONTENT=false in the app's environment. The model client, LangChain and LlamaIndex instrumentations follow it. The CrewAI and MCP instrumentations don't, so their inputs and results are still sent.

An AI agent monitoring checklist

  • Every run is one trace, with a span for each model call, tool call and retrieval.
  • Spans carry duration, tokens, inputs, outputs and errors, and each run carries the agent version, release and prompt version.
  • User and session IDs are trace attributes, not metric labels.
  • Tokens, steps and tool calls are tracked per run, by agent, model and release.
  • Runs that stop at a step or token limit count as failures.
  • A dataset of real cases runs in CI, and the build fails on regressions.
  • A sample of production runs is scored with the same evaluators.
  • Success-rate and latency SLOs are set, with burn-rate alerts instead of an alert per failure.
  • You have decided whether to store prompt and output text, who can read it and how long it is kept.

Frequently asked questions

What metrics matter most for AI agents?

Task success rate, end-to-end latency, errors per step (tool calls especially), tokens and steps per run, and quality scores from evals. Track them by agent, model and release, so a change shows up next to the deploy that caused it.

Can I trace multi-agent pipelines with parallel tool calls?

Yes. Record every step as its own span in one trace, and tool calls that run in parallel appear as spans that overlap in time. In Atatus, each step of an agent or chain is its own span with its kind and duration, and model calls also carry tokens, input and output.

Should AI agents have SLOs?

User-facing agents should. Set a success-rate SLO and a latency SLO, and alert on how fast the error budget is being used rather than on single failed runs, which every agent has now and then.

How is AI agent monitoring different from LLM monitoring?

LLM monitoring tracks single model calls: their latency, tokens and errors. Agent monitoring ties every model call, tool call and retrieval in one task into a single trace, so you can see at which step a multi-step run went wrong. AI agent observability explains the difference in more detail.

Atatus records each step of your Python agents as spans, with tokens, inputs and outputs, next to the traces of the requests that started them. See LLM observability to get started, and how to monitor LLM calls in Python for the per-call details.

← All posts

Get started

See the root cause first.

Start free and send your first trace with OpenTelemetry or the Atatus agents. APM, logs, RUM, infrastructure and SIEM, all on one timeline.

  • SaaS
  • On-premises
  • Hybrid
  • BYOC
  • Unlimited team members
Keep reading