
Observability and Evaluation for AI Agents: Traces, Evals, and the Metrics That Actually Matter

The problem: the agent failed and nobody knows why
A typical scene in a team that already runs an agent in production: the support agent closed a ticket wrong, the operations agent executed the wrong action, the coding agent delivered something that didn't match the request. Someone asks what happened. The honest answer is a shrug: there is a log with the user's input and the model's final response, and nothing in between.
That is the problem. An agent is not a function: it is a chain of decisions. It takes a goal, reasons, picks a tool, observes the result, reasons again, maybe pulls a source, maybe calls another model. If you only store the first and last link, you don't have observability. You have the equivalent of monitoring a server by logging only "it started" and "it went down."
Agent observability is not a big-team luxury. It is the minimum condition for running one responsibly, and evaluation is its other half: it is not enough to see what the agent did; you need to be able to say, with data, whether it is doing it well.
Why traditional logging falls short
Classic logging was designed for deterministic systems: same input, same code, same output. When something fails, the stack trace takes you to the exact line. With an agent, almost all of that breaks:
- The system is non-deterministic. The same input can produce different paths. There is no "line that failed": there is a decision that went wrong in a specific context.
- Intermediate decisions are the behavior. Which tool it chose, with what arguments, what it discarded and why: that is the program. If you don't record it, you didn't record the program.
- Context is part of the state. The system prompt, the retrieved documents, the history, and previous tool outputs determine the next action. A log that doesn't capture context cannot reproduce the failure.
- "No errors" does not mean "good." An agent can complete every call without a single exception and still resolve the task badly. HTTP 200s do not measure quality.
The practical conclusion: with agents, the unit of observability is not the log line or the request. It is the trace.
The trace: the minimum unit of truth
A trace is the complete record of one agent run, step by step, in order: every model call (with its input and output), every tool invocation (with arguments and result), every context retrieval, with timing and cost per step.
This is exactly what tools like LangSmith (from LangChain) and Langfuse (open source) solve. They are not pretty dashboards: they are the place where a run is recorded in a way that another engineer — or you, two weeks later — can reconstruct what the agent did and at which step it went off track.
| What must be in the trace | What it is for |
|---|---|
| Full prompt and version (system + retrieved context) | Reproducing the failure and auditing prompt changes |
| Every model call: input, output, model and version | Separating reasoning errors from data errors |
| Every tool call: arguments and result | Verifying whether it acted on correct information |
| Tokens and cost per step and per run | Detecting expensive steps and internal loops |
| Latency per step | Finding where the time goes |
| Final result and how it was evaluated | Connecting the run to quality |
The differences between the two tools are real but secondary. LangSmith is deeply integrated with the LangChain/LangGraph ecosystem, though it works with other frameworks, and it is a managed service. Langfuse is open source and can be self-hosted, which matters when traces contain data you don't want leaving your infrastructure. The right choice depends on your stack and your data constraints, not on who has better marketing.
The honest warning: neither tool tells you whether your agent is good. They only show you what it did. Defining "good" is still your job, and it is called evaluation.
Offline evaluation: the exam before going to production
Offline evaluation is what you run in your environment, before shipping a change: a set of cases (a dataset) with real or representative inputs and criteria for what counts as success.
- Small, curated datasets beat large, sloppy ones. Fifty cases taken from real production failures teach you more than a thousand generic synthetic cases.
- What is verifiable gets verified with code. If the task has a checkable answer (a passing test, an exact-format field, a query that returns the right record), the judge is a program, not a model.
- Open-ended output gets judged by an LLM with a written rubric. Another model scores the output against explicit criteria. It works, with two caveats: the judge also makes mistakes (calibrate it against human judgments on a sample), and it tends to favor outputs that resemble its own.
- Offline eval is a regression test. Its main job is not to give you a grade; it is to stop today's prompt or model change from silently breaking what worked yesterday. It runs in CI, like tests.
Online evaluation: the truth is in real traces
No dataset anticipates what real users will ask. Online evaluation works on production:
- Sampling real traces: a percentage of runs gets scored automatically (with the same rubrics as offline eval), and a smaller fraction gets reviewed by a human.
- User signals: corrections, retries, escalations to a human, task abandonment. They are noisy signals but impossible to fake: if the user had to redo the work, the agent failed even if its output "looked right."
- Drift: the distribution of what the agent is asked changes over time (new products, new policies, a new season). An eval that was green in March may be measuring a world that no longer exists in June. Datasets get fed with new failures, continuously.
Offline and online don't compete: offline protects you from regressions, online detects the real world. With only the first, you ship calmly and degrade in silence; with only the second, you find out about everything, but late.
The metrics that matter (and the ones that don't)
An agent's production dashboard should look more like an SRE board than a demo. These are the metrics we use as a starting point:
| Metric | What it tells you |
|---|---|
| Task success rate | The share of tasks that end meeting the success criteria. This is the metric; the rest explain it |
| Cost per task | Tokens and calls converted to money per finished task, not per run |
| p50/p95 latency per task | How long the user, or the system depending on the agent, waits |
| Average steps per task | A sustained increase usually means worse context, worse tools, or a disguised loop |
| Human escalation rate | How much of the work the agent could not, or should not, resolve alone |
| Tool error rate | Integration failures: down APIs, invalid arguments, permissions |
And the ones that say almost nothing on their own: total call count, total tokens, "accuracy" without defining against what. If a metric cannot trigger a decision (investigate, roll back, escalate), it is decoration.
This connects directly to an idea we developed in Loop Engineering: every loop needs a verifier that is not the agent itself. Observability and evaluation are that verifier built as a system: the trace lets you see, the eval lets you judge, and the metrics let you alert before a customer reports the problem.
How to start without buying a platform
- Record complete traces from day one, even if it is in your own table or in structured logs. The format matters less than completeness: steps, context, tools, costs.
- Define the success criteria for the main task in one verifiable sentence. Without that, no metric is worth anything.
- Build your first dataset from the last 30 real failures you can remember. You now have an offline eval.
- Adopt LangSmith or Langfuse when reviewing traces by hand starts to hurt. The tool justifies itself when volume demands it, not before.
- Set two boring alerts: success rate below a threshold and cost per task above another. It is the same instinct as alerting on 5xx errors: not glamorous, just operations.
Conclusion
An LLM in production without traces is like a server without metrics or logs: it might work, but you don't know it, and when it stops working you won't know why or since when. Observability is not a later phase of an agent project. It is part of the design, just like the verifier, the limits, and the permissions.
At SolarDevs we build agentic systems in production — including an agent that operates monitoring and incidents over real infrastructure — and the first piece we set up is never the model: it is the trace, the evaluation, and the alerts. If you are taking an agent from demo to production and want a technical second opinion on how to observe and evaluate it, let's talk. No hype: traces, numbers, and decisions you can defend.
Need someone to run this?
DevOps retainers with infrastructure monitoring, CI/CD, and clear monthly packages—from $500/mo.
See pricing