Real Studios

Agent observability: a practical guide for engineering teams

Decorative title card illustration

Agent observability is the practice of capturing structured traces, metrics, evaluations and governance records that make every decision an AI agent takes auditable. It answers the question traditional monitoring never could: not just "did the system respond?" but "why did the agent choose that tool, that answer, that path, and what did it cost you?"

If you do nothing else after reading this, do this: instrument session-level traces and token/cost accounting before you touch anything else. Everything downstream, from debugging to budget control to CI regression tests, depends on that single decision being right from day one.

Agent observability rests on five pillars, and you need all five working together, not just one:

  • Tracing — the hierarchical record of every model call, tool invocation and sub-agent delegation within a session.
  • Metrics — aggregated numbers like latency, cost per session and error rate that feed dashboards and alerts.
  • Logs — discrete events (run started, tool called, policy triggered) that give you the timeline.
  • Evaluation — automated and human judgement of whether the agent's output was actually correct.
  • Governance — the audit trail and policy enforcement layer that compliance and security teams need.

Pro Tip: Wire up a non-blocking trace exporter and a hard turn budget (commonly around twenty-five turns per session) in the same sprint. Together they stop two of the most common production disasters: silent telemetry loss and runaway agent loops that quietly burn through your token budget overnight.

Key Takeaways

Agent observability works because it replaces guesswork with structured traces, cost accounting and continuous evaluation that make agent behaviour auditable and improvable.

PointDetails
Instrument sessions firstAdd root spans with stable run identifiers before anything else so every trace is reconstructable.
Track cost and turns togetherSession cost spikes are often the earliest sign of a silent failure or a runaway loop.
Cap iterations hardUse a fixed turn cap paired with per-tool budgets to prevent runaway costs.
Use OpenTelemetry where possibleGenAI semantic conventions like invoke_agent and execute_tool keep traces portable across backends.
Redact before storingKeep raw prompts, tokens and unbounded outputs out of traces; export asynchronously so tracing never blocks execution.
Convert failures into testsEvery production trace that reveals a bug should become a permanent regression test in CI.
Get expert help instrumentingReal-studios builds session tracing, cost accounting and CI-integrated evaluation pipelines for UK teams running production agents.

Table of Contents

What is agent observability and how does it differ from APM?

Traditional application performance monitoring was built for deterministic systems. A request comes in, a function runs, a response goes out, and if something breaks you get a stack trace pointing at a line of code. Agents don't work that way. The same prompt can produce a different reasoning path, a different tool call, and a different answer on two consecutive runs. That non-determinism is precisely why APM tools fall short: they can tell you a request took 4 seconds, but not why the agent looped through the same tool three times before giving up.

Agent observability replaces the old signal set with one built for probabilistic, multi-step reasoning. Instead of watching HTTP status codes, you watch whether the agent resolved the user's intent. Instead of counting exceptions, you count hallucination rates and tool-call failures. The CNCF's framing of agent observability is blunt about this: every agent session should produce a hierarchical trace covering model calls, tool invocations and sub-agent delegations, and that tracing has to be non-blocking or you'll slow down the very system you're trying to protect.

Here's how the two worlds map onto each other:

  • Traditional: HTTP latency → Agent: end-to-end session duration including model think-time.
  • Traditional: error codes (4xx/5xx) → Agent: hallucination rate, tool-call failure, policy violations.
  • Traditional: request count → Agent: turn count and token consumption per session.
  • Traditional: stack traces → Agent: full reasoning trace with prompt version and tool arguments.
  • Traditional: uptime → Agent: task success rate as judged by evaluation, not just "did it respond".

Picture a customer support agent that gets asked for a refund status. It calls a lookup tool, gets a malformed response, retries the same tool with the same arguments four times, then fabricates an answer rather than escalating. APM shows you a healthy 200 response and normal latency. Nothing looks wrong. Only a trace paired with an evaluation layer catches that the agent hallucinated a refund date that never existed, because Azure's agent observability guidance makes clear that observability for agents has to combine tracing, metrics, logging, automated evaluation and governance to catch failures like this across the full lifecycle, not just at the infrastructure layer.

What should you instrument in an agent?

Instrumentation for agents needs more granularity than a typical microservice, because the failure you're chasing is often buried three or four decision steps deep. Here's the concrete list to work from.

  • Session/root span (invoke_agent) — one span per user session with a stable run identifier that every child span inherits. This is your anchor for reconstructing the full path later.
  • Model call spans (chat) — one per LLM call, recording model name, prompt version, input/output token counts and latency. Prompt version matters more than teams expect: without it, you can't tell whether a regression came from a model update or a prompt change.
  • Tool-invocation spans (execute_tool) — tool name, a digest of the arguments (not the raw payload), result class (success, timeout, malformed), and duration.
  • Retrieval metadata — the query, document identifiers or digests, and relevance scores for any RAG step, with redaction applied before storage.
  • Per-session token and cost accounting — running totals plus turn count, and boundary events like budget_exhausted or run_failed that mark the session's terminal state.

That span naming convention (invoke_agent, chat, execute_tool) isn't arbitrary. It comes from the OpenTelemetry GenAI semantic conventions, which exist specifically to give agent frameworks a common vocabulary for these spans so your traces remain portable across backends. Recommended event types worth adopting alongside your spans include run_started, model_call_completed, tool_call_requested, policy_decision, run_completed and run_failed, each carrying a schema version so you can evolve the format without breaking downstream consumers, according to engineering guidance on agent observability.

A tool-call span payload, conceptually, looks something like this: a span name of execute_tool, a tool.name attribute, a tool.arguments.digest (a hash, not the raw JSON), a tool.result.class of "success" or "timeout", and a duration in milliseconds. Nothing in that payload could leak a customer's account number even if the trace store were compromised.

Pro Tip: Keep span names and attribute keys low-cardinality and stable across versions. Put sensitive content in a redacted payload store keyed by trace ID, never in the span attributes themselves. A trace explorer with 40,000 unique attribute keys is unusable, and a leaked prompt in a span name is a security incident.

Should you use baked-in instrumentation or OpenTelemetry?

The honest answer is: it depends on how many frameworks you expect to run and how long this system needs to live. Both approaches export broadly the same core data. Tokens, model metadata, tool arguments and latency show up whichever route you take. The difference is in portability and long-term maintenance cost.

Comparison chart of baked-in instrumentation vs OpenTelemetry

Baked-in instrumentation, the kind shipped directly by a framework's own SDK, gives you tight integration and rich, framework-specific semantics out of the box. You get useful detail with almost no setup. The cost shows up later: you're coupled to that vendor's trace format, and if you switch frameworks or add a second one, you're maintaining two incompatible telemetry pipelines side by side.

OpenTelemetry with GenAI semantic conventions takes longer to wire up initially, particularly if your framework needs a bespoke adapter, but it pays that cost back with portability. Standardised span types mean your traces can flow to any OTel-compatible backend without rewriting your instrumentation layer, which matters enormously the moment you run more than one agent framework or need to switch trace backends without a re-platforming project.

Here's the practical decision rule: for a quick prototype or a single-framework proof of concept, baked-in instrumentation gets you observability fastest. For anything heading into enterprise production, especially where you might run agents built on different frameworks or need to satisfy a platform team's backend-agnostic requirements, OpenTelemetry is the safer long-term bet.

Pro Tip: Start with baked-in instrumentation to validate the agent's behaviour quickly, then migrate the trace schema to OpenTelemetry conventions once the agent moves toward production. You lose almost nothing in speed and gain a straight path to a vendor-neutral trace backend later.

How do you run agents safely in production?

Production is where good intentions about observability meet real budget constraints, real privacy obligations and real trace volume. The teams that get burned are almost always the ones relying on reactive alerts instead of proactive limits.

  1. Set hard guardrails first. A turn cap per session, per-tool call budgets, and cost circuit breakers stop runaway loops before they become a five-figure token bill. Oracle's guidance on runtime budget guardrails is explicit that these caps work better as prevention than as post-hoc alerting, because by the time an alert fires, the damage is already done.
  2. Monitor cost as a leading indicator, not a lagging one. Track session cost against a rolling average and set burn-rate alerts per agent, not just per account. A sudden spike in one agent's average session cost is very often the first visible sign of a silent failure, long before error rates move.
  3. Sample and retain deliberately. Use deterministic sampling keyed on run_id so a single session's spans are either all kept or all dropped, never split. Set retention windows that reflect your actual debugging window and storage budget, not an arbitrary "keep everything forever" default.
  4. Export traces asynchronously. A batched exporter that buffers spans and flushes them off the critical path, with a graceful drain on shutdown, means telemetry never adds latency to the agent's actual work.
  5. Redact before you store. Never persist raw prompts, bearer tokens, full personal data or unbounded tool outputs. Store digests, stable identifiers and result classes instead, with a documented redaction policy your security team has actually reviewed.
  6. Keep metrics low-cardinality. Push aggregated numbers to a system like Prometheus for alerting, but keep per-session identifiers out of your metric labels. The CNCF's operational guidance is direct on this: per-session detail belongs in traces, not in metric labels, or you'll trigger a cardinality explosion that takes down your metrics backend.

A cost spike rarely shows up alone. It tends to arrive alongside a subtle behavioural change, an agent retrying a failing tool call, or looping through a reasoning branch it should have abandoned. Treat an unexplained rise in session cost as a canary for a silent failure worth investigating immediately, not a billing footnote to review at month end.

Pro Tip: Build a diagnostic "doctor" command that a developer can run against any run_id to print the full span tree, token totals and any policy violations in one output. When production breaks at 2am, that single command saves you from grepping through raw logs.

Developer running diagnostics on server hardware

How do you turn traces into continuous evaluation?

Traces tell you what happened. Evaluations tell you whether what happened was actually good. The gap between those two is where most agent quality problems hide, and closing it is what separates teams that improve steadily from teams that keep shipping the same bugs.

The workflow is a loop: capture production traces, pull the failures into an evaluation dataset, fix the underlying issue, then add that exact scenario as a regression test so it can never silently reappear. LangChain's guidance on agent observability describes this as the core mechanism that connects production traces to genuine improvement, turning every failed session into a permanent test case rather than a one-off incident report.

Several evaluation types belong in that pipeline, and they're not interchangeable:

  • Contract checks — did the agent's output match the expected schema or format?
  • Scenario-based tests — does the agent handle a fixed set of known tricky inputs correctly?
  • Replay-based comparisons — run the same trace against a new model or prompt version and diff the outcome.
  • LLM-as-judge evaluation — use a second model to score correctness, tone or safety at scale.
  • Human review — reserved for high-impact or ambiguous cases where automated judgement isn't trustworthy yet.

Enterprise platforms increasingly build these evaluators in directly. Evaluation categories such as intent resolution, task adherence and tool-call accuracy are baked into Azure's evaluation and governance tooling, and integrating that kind of evaluation into your CI/CD pipeline is treated as a baseline requirement, not an advanced feature.

In practice, that means running a small evaluation suite on every pull request to catch obvious regressions fast, then a fuller nightly suite that covers the long tail of scenarios you've accumulated from production traces. Merges get blocked when a change causes a statistically meaningful drop against the baseline, the same way a failing unit test would block a merge in traditional software.

Pro Tip: Calibrate your LLM judge against a set of human-labelled examples before trusting it in CI, and keep a human-in-the-loop threshold for any change touching payments, medical guidance or anything else where a wrong answer has real consequences. An uncalibrated judge model will happily wave through a regression it doesn't understand.

Which tools should you know for agent observability?

You don't need to evaluate every option on the market, but you should know the shape of the landscape before you commit to one. Here's a fair, non-exhaustive tour of what exists and where each fits.

  • OpenTelemetry with GenAI semantic conventions is the standard to build toward if portability matters to you. It's not a product, it's a schema, which means it works with whichever backend you choose today and whichever one you migrate to in three years.
  • LangChain and LangSmith give tight, baked-in tracing for agents built on the LangChain framework, with a strong focus on turning production traces directly into evaluation datasets, which fits the capture-to-regression loop described above.
  • W&B Weave approaches observability from the experiment-tracking angle familiar to teams already using Weights & Biases for model training, extending that same rigour into evaluation and tracing for agents.
  • Langfuse is a popular open-source option for trace capture, prompt versioning and evaluation, useful when you want visibility without committing to a single vendor's ecosystem.
  • Azure AI Foundry, including its Copilot Observability Agent, feeding into Azure Monitor, gives enterprise teams built-in evaluators for intent resolution, task adherence and safety alongside governance features that compliance teams tend to ask for by name.

Each of these solves a slightly different piece of the puzzle: some are primarily trace capture and visualisation, some lean into evaluation engines, some focus on CI integration, and some add governance consoles for audit and compliance. None of this is an endorsement to pick one over another. The right choice depends on your existing framework, your team's integration budget and how much you value backend portability versus out-of-the-box depth. If your organisation is also thinking about the policy and access-control side of agent deployments, the security-focused perspective in this agent governance playbook is worth a read alongside your tooling decision.

What's the quickest path to getting started?

Here's a step-by-step sequence that gets a working observability layer in place without a multi-quarter platform project.

  1. Add a session/root span with a stable run_id. (Roughly 1 to 2 hours.) Success looks like: every session produces exactly one root span, and you can find it by ID.
  2. Instrument model calls as chat spans. (2 to 4 hours for a small agent.) Success looks like: model name, prompt version and token counts appear on every span.
  3. Wrap tool calls as execute_tool spans. (2 to 3 hours per tool integration.) Success looks like: you can see tool name, duration and result class without opening a log file.
  4. Add token and cost counters per session. (About 30 minutes if token counts are already captured.) Success looks like: a running cost total updates in near real time.
  5. Implement turn budgets and a hard cap. (1 to 2 hours.) Success looks like: a session actually terminates and hands off to a human once it hits the defined turn limit.
  6. Wire a non-blocking exporter. (Half a day, more if your infrastructure team needs to provision a new collector.) Success looks like: agent latency is unchanged with tracing on versus off.
  7. Set up cost and burn-rate alerts. (1 to 2 hours once metrics are flowing.) Success looks like: a test session that exceeds budget actually triggers a Slack or PagerDuty alert.

None of these steps require a rewrite. They layer onto an existing agent one span at a time, which is exactly why this order works: each step is independently useful even if you stop after step four.

What does the evidence say about doing this properly?

The clearest signal across the engineering literature on this topic is that standardisation and reproducibility beat cleverness. OpenTelemetry's GenAI semantic conventions exist precisely because ad hoc trace formats don't scale past one team or one framework, and the conventions themselves define readable span types like invoke_agent, chat and execute_tool so that a trace generated by one framework can be read, filtered and alerted on by any OTel-compatible backend.

Guardrails follow the same pattern. A hard iteration cap around 25 turns, paired with per-tool call budgets, consistently outperforms reactive alerting because it prevents the runaway cost scenario rather than merely notifying you after it's already happened, a point Oracle's engineering team makes directly in their guardrail guidance.

The debugging philosophy worth internalising is reproduction-first. Scrolling through raw logs to reconstruct what an agent did is slow and error-prone. A replay tool that re-runs a trace with the exact production inputs, a pinned model version, and recorded tool responses gets you to root cause far faster, because it removes the non-determinism that made the original bug hard to find in the first place, according to the OpenTelemetry GenAI semantic conventions project.

Here's how that plays out in practice: a production trace shows an agent hallucinating a delivery date after a retrieval step returned zero documents. That exact trace, replayed with pinned inputs, becomes a fixed test case. The fix (falling back to "no data found" instead of guessing) ships, and the replayed trace becomes a permanent regression test that runs on every future pull request. That's the entire loop captured in research on continuous evaluation: failures aren't just fixed, they're converted into permanent tripwires.

Pro Tip: Whenever you fix a production bug found through a trace, spend the extra ten minutes turning that exact trace into a named regression test before you close the ticket. It's the single highest-leverage habit in this entire discipline, and it's the one teams skip most often under deadline pressure.

What do engineering teams get wrong about observability?

Most teams treat observability as a monitoring dashboard problem when it's actually a decision architecture problem. They wire up Grafana, watch latency graphs, and feel covered, right up until an agent starts hallucinating in a way that never trips a single infrastructure alert because the HTTP response was perfectly healthy the whole time.

The pitfalls tend to repeat themselves across teams: trace volume balloons faster than anyone expects once an agent runs in production at scale, sensitive data ends up in span attributes because nobody wrote a redaction policy before launch, and false alarms from over-aggressive alerting train engineers to ignore the pager within a fortnight. All three are avoidable, and all three are cheaper to prevent than to fix retroactively.

Where this fits in a roadmap matters more than people assume. Observability isn't a "nice to have after launch" line item. It belongs in the same sprint as the first working prototype, because retrofitting tracing onto an agent that's already handling real traffic means you're debugging blind for however long that gap lasts. Teams that build the trace layer alongside the agent itself, rather than after a production incident forces the issue, consistently spend less total engineering time on observability over the life of the project.

One habit worth adopting early: automate trace analysis rather than relying on someone remembering to look. A scheduled job that scans yesterday's traces for cost outliers, unusually long sessions, or repeated tool failures, and posts a summary automatically, catches problems days before a human would have noticed them by chance.

How can Real-studios help you build this?

Real-studios is the practical route to agent observability if your team doesn't have the spare engineering capacity to build a full instrumentation and evaluation pipeline from scratch. Building this properly, spans, guardrails, evaluation datasets, CI integration, takes real engineering weeks even for a team that knows what it's doing, and most UK businesses are trying to fit it around an already full product roadmap.

Real-studios works through a straightforward engagement: an audit of your current agent architecture and telemetry gaps, a pilot instrumentation phase covering session traces, model call spans and cost accounting, integration of evaluations into your CI/CD pipeline, then handover with ongoing support. That covers custom automations and agent workflows as well as integrations connecting your agents to the data sources, vector stores and enterprise systems they actually rely on.

If you want a fast, low-risk way to see this working before committing to a larger build, start with a scoped pilot project to get your first agent properly instrumented and evaluated within weeks, not quarters.

Where to read more on this

The standards and guides below are worth bookmarking once you start building your own instrumentation layer.

  • The OpenTelemetry GenAI semantic conventions project is the canonical reference for span types and attribute naming if you're building toward OTel compatibility.
  • CNCF's piece on observability for AI agents covers the non-blocking export and cardinality guidance in more operational depth than fits here.
  • LangChain's guide to agent observability walks through the trace-to-evaluation-dataset workflow with concrete examples.
  • Azure's Agent Factory post on observability best practices is a strong reference for evaluator categories and CI/CD integration patterns at enterprise scale.
  • Weights & Biases' article on evolving observability standards gives a useful counterpoint on how evaluation categories are shifting as the field matures.

Frequently asked questions

What is the difference between agent observability and LLM observability? LLM observability typically focuses on a single model call, tracking prompt, response, latency and token usage. Agent observability covers the full multi-step session, including every tool call, retrieval and sub-agent delegation the agent makes on the way to a final answer.

Do I need OpenTelemetry if I'm only using one framework? Not necessarily at first. Baked-in instrumentation from that framework will get you moving faster. Migrate to OpenTelemetry's GenAI conventions once you expect to run a second framework or need vendor-neutral trace storage.

How many turns should an agent be allowed before a hard cutoff? There's no universal number, but a cap of about twenty-five turns per session is a commonly used starting point for preventing runaway loops, adjusted up or down based on your agent's typical task complexity.

What should never appear in a trace? Raw prompts containing personal data, bearer tokens, full unbounded tool outputs and anything else that would be sensitive if the trace store were ever exposed. Store digests and stable identifiers instead, with a documented redaction policy.

How do I stop my observability pipeline from adding latency to my agent? Use a non-blocking, batched exporter that buffers spans and flushes them asynchronously off the execution path, with a graceful drain configured for shutdown so no spans are lost mid-flush.

Sources

Recommended

All guides