Observability for AI Agents: Tracing, Evals and Cost per Task
An AI agent that works in a demo and an AI agent you can run in production are two different things. The difference is observability. When an agent gives a wrong answer, takes a strange action or burns through its budget, you need to be able to see what happened and why.
The principles are the ones SRE teams already know. The signals are a little different.
1. Trace Every Step
One request to an agent can turn into dozens of steps: model calls, tool calls, retrieval lookups, retries. Capture all of them as a single trace. The OpenTelemetry project now defines conventions for generative AI workloads, so agent traces can sit in the same tooling as the rest of your stack.
For each step, record:
- The model and its settings
- The tool that was called and whether it succeeded
- The tokens in and out
- How long it took
2. Measure Quality, Not Just Uptime
A traditional service is either up or down. An agent can be up, fast and wrong. That is why you need evals: repeatable checks that score the output against what a good answer looks like. Some are simple assertions. Some use a second model as a judge. Some are human review of a sample.
3. Run Evals Before You Ship
Treat a prompt or model change like a code change. Keep a set of test cases with known good outcomes and run them in CI. If the score drops, the change does not go out. It is regression testing for behaviour.
4. Keep Checking in Production
Real users ask things your test set never imagined. Sample live traffic, score it and watch the trend. A slow decline in quality is easy to miss without a number on a dashboard.
5. Know Your Cost per Task
Token spend per request is a start, but the number that matters is cost per completed task. An agent that loops five times to finish a job costs five times as much. Track it, set budgets and alert when a task runs away.
6. Set Service Levels for Agents
Decide what “good” means and write it down as service level objectives: task success rate, time to complete, cost per task. Then manage the agent against them the way you would any other service, error budget included.
7. Alert on the Unusual
Useful alerts for agents include a sudden rise in tool errors, a jump in steps per task, an eval score falling below a threshold and spend crossing a budget line.
8. Protect What You Log
Prompts and responses often contain personal or sensitive data. Mask it before it is stored, control who can read traces and set a retention period.
Conclusion
Agents are software, and software in production needs to be observable. Tracing tells you what happened, evals tell you whether it was any good and cost tracking tells you whether it was worth it. Build these in from the first deployment, not after the first incident. This sits at the meeting point of our SRE and Observability and GenAI work, and it is one of the most useful investments an AI team can make.