Observability for AI agents
What to record about every agent run, and how to spot runs that need a person.
Traditional monitoring asks 'is it up and fast?'. For agents you also need 'what did it decide, and why?'. A trace per run records each model call (latency, tokens, cost), each tool call (name, arguments, outcome) and how the run ended (answer, step limit, budget, error).
Flag the runs worth reading: refused or invalid tool calls, tool calls nobody asked for, instruction-like text in tool output, runs that hit limits, and answers users marked as wrong. These are your next evaluation cases.
OpenTelemetry has conventions for AI calls, so traces can go to the monitoring tools you already use, including Azure Monitor. Traces contain whatever the agent read, so mask secrets and personal data and control who can see them.
Cost. Free to start with JSON Lines files. In Azure, Application Insights and Log Analytics charge by data stored.
Use it when
- an agent is used by more than a few people.
- you need to explain a strange answer or action.
- costs or latency are climbing.
How it works
- Trace id
- Ties all lines of one run together.
- Model events
- Latency, tokens, cost.
- Tool events
- Name, arguments, outcome.
- Flags
- Refusals, injections, limits.
- Dashboards and alerts
- Trends and spikes across runs.
Options
- Files (JSON Lines)
- Simple, local, fine for a team trial.
- OpenTelemetry to a backend
- Search, dashboards and alerts at scale.
Example. Ironbridge Payments alerts when more than 2% of agent runs in an hour include a refused write. The alert fired once, after a supplier feed started including instruction-like notes, and the team blocked that feed from the agent within the hour.
Don't confuse it with
- Logs
- Separate lines, often from many runs mixed together.
- Traces
- Every step of one run, linked by an id.
Words to know
- Trace
- Every step of one run, linked by an id.
- Span
- One timed step inside a trace.
- OpenTelemetry
- An open standard for traces, metrics and logs.
Where to look
- trace.jsonl
- Azure Monitor
- Application Insights
Practise it
Read it in the guide, next to the tasks and labs.
Open in DevOps, Hands On