Contents
At a glance
- Category
- Core agent concept
- Minimum trace
- Rendered prompt, model params, every tool call and result, output, tokens, cost, latency
- Log the rendered prompt
- Not the template - the bug is usually in what got interpolated
- Standard
- OpenTelemetry publishes semantic conventions for generative-AI spans
- Alert on
- Failure rate, step-cap hits, cost per run, p95 latency
- Privacy note
- Traces contain customer text - set a retention window and check your DPA covers it
What observability means for AI systems
Observability is the ability to answer "why did it do that" after the fact, without reproducing the run. For an AI agent that means storing, for every execution: the system prompt and input, every model call with its parameters, every tool call with arguments and result, the final output, the token counts, the cost and the latency of each step.
Ordinary application logging is not enough, because the interesting failure is not an exception. The agent ran cleanly and produced the wrong answer. The only way to diagnose that is to read the trace - and if you did not capture the exact prompt that was sent, including whatever retrieved context was injected into it, you cannot.
What to log, in order of value
If you log one thing, log the fully rendered prompt as sent, not the template. Templates plus variables look complete and are not - the bug is usually in what got interpolated. Second, log tool arguments and raw results, because "the agent booked the wrong slot" almost always turns out to be "the calendar tool returned times in a different timezone".
Third, log token counts and cost per step. This is what turns a vague "the AI bill went up" into "step three's context tripled when we added the transcript". Fourth, log latency per step, because customer-facing automations live or die on a latency budget and the slow step is rarely the one you assume. Fifth, attach a stable run ID that also appears in your CRM record, so a customer complaint can be traced back to the exact execution.
Cost, tooling and retention
Dedicated LLM tracing tools - Langfuse, LangSmith and others - give you the trace view, cost breakdown and dataset capture without building it. There are open-source options you can self-host, which matters if the prompts contain customer data. OpenTelemetry now publishes semantic conventions for generative AI spans, so traces can live alongside the rest of your application monitoring rather than in a separate silo.
Retention is where the privacy question bites. Full traces contain whatever your customers wrote, so decide a retention window, redact obvious personal data on the way in where you can, and make sure that whatever you promise in your data processing agreement matches what your tracing tool actually stores and where. See also data residency.
What you should know
Instrument before you launch, not after the first incident. Retrofitting tracing means the run you most want to inspect is the one you did not capture. It is also the cheapest thing on this list to add at the start and the most annoying to add later, because it touches every step.
Alert on a small number of things rather than everything: run failure rate, the share of runs hitting the step cap, cost per run above a threshold, and p95 latency. Those four catch nearly every real problem, and the traces you already captured are what let you fix it. They also feed straight into your eval set - a captured production failure is the best test case you will ever write.
Observability FAQ
What is LLM observability?
Capturing enough detail about every AI run - prompts as sent, tool calls and results, outputs, tokens, cost and latency - that you can reconstruct what happened without rerunning it. Standard application logs are not enough because the failure is usually a clean run with a wrong answer.
What should I log for an AI agent?
The fully rendered prompt including any retrieved context, the model and its parameters, every tool call with its arguments and raw result, the final output, token counts, cost and per-step latency, all under one run ID that also appears on the related record in your CRM.
Why log the rendered prompt instead of the template?
Because the bug is almost always in the interpolation. The template looks correct while the variable it received was empty, truncated, or carried text from the wrong record. A template plus a list of variable names does not let you see what the model actually read.
Do I need a special tool, or will normal logging do?
Normal logging works if you are disciplined, but purpose-built tracing tools give you the nested run view, per-step cost breakdown and dataset capture for free. Several are open-source and self-hostable, which matters when your prompts contain customer data you would rather not send to another vendor.
What should I alert on?
Four things cover most real incidents: run failure rate, the proportion of runs hitting the step cap, cost per run crossing a threshold, and p95 latency. Alerting on everything else produces noise that gets muted, which is worse than not alerting at all.
How long should I keep AI traces?
Long enough to investigate complaints and build eval sets, short enough to match what you promised customers. Traces contain whatever people wrote to you, so the retention window belongs in your privacy policy and data processing agreement, and the storage location matters if you have data residency commitments.
Primary source
OpenTelemetry - generative AI semantic conventions
Checked August 2026. Anything priced or rate-limited moves, so verify against the source before you budget.
Want this built rather than explained?
Knowing what observability means is one thing; having it running in your business is another. We scope one workflow at a time, quote a fixed price in writing after a free consult, build it, and hand it over with documentation you own.
