LLM observability platform: a complete guide for AI teams

Learn how to instrument, monitor, and evaluate LLM apps in production with traces, metrics, evals, and the right observability platform for your stack.

Aron Schuhmann

Written by

Aron Schuhmann

Abhi Aiyer

Reviewed by

Abhi Aiyer

Jun 22, 2026

·

21 min read

Your AI agent can return a 200 OK with a completely wrong answer. Traditional monitoring tells you whether a service is up. An LLM observability platform tells you whether that service is actually doing its job: returning accurate, grounded, cost-efficient responses in production.

According to VentureBeat's early-2026 VB Pulse survey, enterprises that went wide on retrieval-augmented generation in 2025 are hitting a wall at scale. For 33% of them, rebuilding the retrieval stack is now the stated priority. The failures driving that rebuild (wrong chunks retrieved, ungrounded answers, silent accuracy drift) are exactly the kind standard infrastructure monitors never catch.

This guide covers what LLM observability is, why it matters for production AI systems, the components and metrics you need to track, and how to evaluate platforms that fit your stack.

What is LLM observability?

LLM observability is the practice of collecting and analyzing real-time data about your model's inputs, outputs, performance characteristics, and costs so you can monitor, debug, and improve applications at scale. If you're running LLM-powered features in production, you need visibility into model behavior that goes far beyond uptime checks.

A working LLM observability platform brings together traces, metrics, logs, and evaluation scores across every model call, tool invocation, and agent step in your system.

How LLM observability differs from traditional software observability

Traditional observability focuses on deterministic systems. You instrument HTTP handlers, track error codes, and measure p99 latency. A request either succeeds or fails, and the same input reliably produces the same output.

LLM applications break this model. The same prompt can produce different responses on consecutive calls. A technically successful API response might contain hallucinated facts, miss critical context, or drift off-task. Binary pass/fail metrics can't capture these failures.

Cost tracking also changes shape. Traditional observability measures CPU, memory, and disk. LLM observability must track token usage per call, per model, and per user, because token spend directly determines your infrastructure bill.

Why LLM-specific instrumentation is necessary

You need LLM-specific instrumentation because standard APM tools weren't designed for non-deterministic outputs, multi-step agent loops, or token-based pricing. Standard spans don't capture prompt content, retrieved context, or tool call sequences.

Without purpose-built instrumentation, you can't answer basic operational questions: which prompt version caused a quality regression, how many tokens a single agent run consumed, or whether your retrieval step actually returned relevant documents. Generic logging gives you volume, but LLM observability gives you the signal to act on it.

Why LLM observability matters

Your production AI system can degrade silently in ways that no health check will catch. Observability is what stands between you and the three risks that sink AI projects: unreliable outputs, runaway costs, and compliance failures.

Reliability and uptime in production AI systems

When you ship an agent to users, accuracy regressions can happen at any time. A model provider pushes a new version, your prompt drifts, or a tool starts returning malformed data. If you've shipped agents to production, you're probably checking traces daily, because agents can regress while still appearing healthy to your infrastructure monitors.

Without observability, you discover these regressions from user complaints. With it, you catch them from automated evals and trace inspection before users notice.

Cost control and token budget management

Your agents burn tokens quickly, and the costs compound faster than most teams expect. They run in loops, generate multiple candidate responses, and accumulate context from tool results, memory, and conversation history. Imagine a startup that goes viral and discovers a six-figure token bill the following month. Without granular cost data, there's no way to pinpoint where the spend is coming from.

An LLM observability platform lets you track token usage per call, per agent run, and per user segment. You can identify which steps consume the most tokens, spot runaway loops, and set budget alerts before costs spiral.

Trust, compliance, and responsible AI requirements

If your agent handles sensitive data, regulated industries, or customer-facing decisions, you need an audit trail. Observability gives you prompt and response capture, traceability across agent steps, and the data foundation for hallucination detection and content safety reviews.

Compliance teams need to know exactly what your model saw and said. A well-instrumented system makes that answerable.

Core components of an LLM observability platform

Four interlocking components give you full visibility into LLM application behavior. Each captures a different dimension of what your system is doing and how well it's doing it.

Traces and spans across model calls and tool use

A trace captures the full execution path of a request through your system as a tree of spans. In an agent context, that tree might include a user message, a model call, two tool invocations, a retrieval step, and a final response generation.

The standard format is OpenTelemetry (OTel), with the OpenInference semantic layer adding AI-specific attributes on top. Each span records timing, status, and telemetry metadata. Tracing UI gives you a flame-chart view of how long each step took, the exact JSON flowing into and out of each LLM call, and call metadata like status codes and latency that help you scan for anomalies.

Metrics: latency, token usage, throughput, and error rates

You need quantitative signals that aggregate across requests. The core metrics for any LLM observability platform include:

  • Latency: time from input to output, measured per model call and end-to-end

  • Token usage: input and output tokens per call, broken down by model and provider

  • Throughput: requests processed per second, useful for capacity planning

  • Error rates: failed calls, timeouts, and rate-limit hits as a percentage of total traffic

These metrics power dashboards and alerting. They tell you whether your system is healthy right now, and whether it's trending in the right direction.

Logs and prompt/response capture

Structured logs capture the actual content flowing through your system: the prompt sent to the model, any retrieved documents injected via RAG, and the full response. For agent systems, this includes tool call arguments and results at each step.

Prompt management becomes critical at scale. You need to version prompt templates, track which version ran on which trace, and roll back when a change degrades quality. Without this link between prompt templates and trace data, diagnosing quality regressions requires guesswork.

Prompt and response capture is essential for debugging quality issues, but it also creates data-handling obligations. You'll need to decide on sampling rates, retention policies, and redaction strategies for sensitive content.

Evals and output quality scoring

Metrics tell you whether your system is fast and available. Evals tell you whether it's correct. Because LLM outputs are non-deterministic, you can't rely on traditional assertions.

Common eval approaches include:

  • LLM-as-judge: pass the output, original input, and retrieved context to a second model with a scoring rubric

  • Classification evals: measure how accurately the model tags or categorizes data

  • Tool calling evals: verify the agent invoked the right tools with the right arguments

  • Task completion: did the agent finish the job? This is usually the single most important eval

  • Faithfulness scoring: measure whether the generated response is grounded in the retrieved context, not hallucinated beyond it

A mature eval strategy combines offline runs against fixed datasets before deploys with online evaluations against live production traffic. Start offline and layer in online evaluation as your system reaches production scale. Eval datasets built from hand-curated examples, synthetic cases, and production logs consistently produce sharper signal, a finding we documented in our book Principles of Building AI Agents.

Key observability metrics to track

Effective observability means tracking metrics at three distinct layers: model performance, operational infrastructure, and business impact. Tracking only one layer leaves blind spots.

Model performance metrics

These metrics capture how well your model is doing its core job. Track correctness first: how often does the model produce a factually accurate response? Then measure relevance (whether responses address the actual query), faithfulness (whether the response stays grounded in retrieved context), and coherence (whether outputs are internally consistent and well-structured).

For agent workflows, add tool selection accuracy: how often the agent picks the right tool for the task. If you're using LLM-as-judge scoring, track score distributions over time to detect quality drift.

Operational and infrastructure metrics

Operational metrics cover the health of your serving infrastructure. The following table summarizes the key signals:

CategoryMetricWhat it tells you
LatencyTime-to-first-token, total response timeWhether your system feels responsive to users
ThroughputRequests per second, concurrent agent runsWhether you have capacity headroom
Resource useGPU/CPU utilization, memory consumptionWhether you're hitting hardware limits
Token economicsTokens per call, cost per agent runWhether your unit economics are sustainable
ErrorsRate-limit hits, timeouts, 5xx responsesWhether provider or infra issues are affecting users

Business and user-impact metrics

Engineering metrics don't necessarily tell you whether business objectives are being met. You need domain-specific outcome metrics alongside your observability data.

For a customer support agent, that might be resolution rate and escalation frequency. For a code generation tool, it might be acceptance rate of suggested changes. For a legal review agent, it could be false approval rate on contract analysis.

Map your north star business metric back to the failure modes your observability system can detect. That connection closes the loop between engineering effort and business outcomes.

Evaluating and choosing an LLM observability platform

Your choice of LLM observability platform will shape how effectively you can debug, optimize, and scale your AI applications. Evaluate candidates across four dimensions: how they handle open-source vs. managed deployment, the breadth of their integration surface, their real-time analytics performance, and how their cost scales as trace volume grows.

Open-source vs. managed platforms

Open-source LLM observability tools give you full control over data, deployment, and customization. You run the infrastructure, and you own the data. The strongest open-source options bundle eval workflows, annotation queues, prompt management, and dataset versioning into a single self-hosted platform. Proxy-based approaches take a different route, instrumenting your calls with minimal code changes, while others fold agent observability into an existing enterprise monitoring stack, useful if your team already runs that infrastructure for everything else.

Managed platforms reduce operational burden but introduce vendor lock-in and data residency considerations. The tradeoff is straightforward: operational simplicity vs. control and cost predictability at scale.

For teams that want the control of open source LLM observability without managing their own storage layer, several platforms offer hosted versions of their open-source cores. Evaluate whether the hosted tier's pricing model aligns with your expected trace volume.

Integration surface: SDKs, OpenTelemetry compatibility, and model provider coverage

Your platform needs to work with the models, frameworks, and infrastructure you already use. A broad integration surface saves you from writing custom instrumentation for every new component. Check for the following:

  • Native SDKs or auto-instrumentation for your language and framework

  • OpenTelemetry compatibility for vendor-neutral trace export

  • Coverage across your model providers (OpenAI, Anthropic, Google, open-source models)

  • Support for agent frameworks, RAG pipelines, and tool-calling patterns

Real-time analytics and trace lookup performance

When a user reports a bad response, you need to find that specific trace fast. When you're investigating a quality regression, you need to aggregate eval scores across thousands of runs in seconds.

Test your platform's query performance with realistic data volumes before committing. Dashboards that load slowly or trace lookups that time out will undermine adoption on your team.

Cost-effective scaling as trace volume grows

LLM observability data grows proportionally with your traffic. A platform that's affordable at 10,000 traces per day might become prohibitively expensive at 10 million.

Evaluate pricing models carefully. Per-trace pricing can surprise you as usage scales. Storage-based pricing with good compression tends to be more predictable. Consider whether the platform supports sampling strategies that let you reduce volume for high-traffic, low-risk endpoints while maintaining full capture for critical agent runs.

A comparison of leading LLM observability platforms

The table below covers the major options across the key evaluation dimensions. Some tools are focused observability platforms, others include an AI gateway that sits in the model routing path and handles cost tracking, caching, and fallbacks at the infrastructure level.

PlatformTypeStrengthsBest for
Mastra StudioOpen-source / hosted (TypeScript)Real-time agent traces, scorer-based evals, prompt editing, OTel-compatible; native to Mastra's TypeScript frameworkTypeScript teams building agents who want observability built in, not bolted on
LangfuseOpen-source / hostedDeep eval workflows, annotation queues, prompt management, agent observabilityTeams wanting full data ownership with strong eval support
LangSmithManaged (LangChain)Native LangChain and LangGraph integration, dataset management, eval suitesTeams already on the LangChain ecosystem
Arize PhoenixOpen-sourceOpenInference standard, strong RAG pipeline support, retrieval metricsRAG-heavy workloads needing retrieval quality metrics
Arize AIManagedML monitoring + LLM observability in one platform, root cause analysis toolingEnterprise teams with existing Arize AI infrastructure
HeliconeOpen-source / proxyZero-code proxy instrumentation, caching, rate limitingTeams wanting fast time-to-value without SDK changes
PortkeyAI gateway + observabilityModel routing, fallbacks, caching, cost tracking across LLM providersTeams routing across many LLM providers with one AI gateway
TruLensOpen-sourceLLM-as-judge eval framework, faithfulness scoring, feedback functionsTeams prioritizing eval-first workflows
LunaryOpen-source / hostedMulti-provider support, generative AI cost tracking, dataset toolingStartups wanting open-source with a managed option
Datadog LLM observabilityManagedIntegration with existing Datadog infrastructureEnterprise teams already on Datadog
LlamaIndexFramework with tracingNative RAG pipeline instrumentationTeams using LlamaIndex for document retrieval
CrewAIFramework with tracingMulti-agent workflow observabilityTeams building CrewAI agent systems

Mastra: built-in LLM observability for TypeScript agents

If you're building agents in TypeScript, Mastra gives you observability without wiring up a separate instrumentation layer. Every agent call, tool invocation, and workflow step is traced automatically, with no SDK integration required, producing structured, OTel-compatible traces. All three signals (traces, logs, and metrics) share correlation IDs, so you can jump straight from a metric spike to the exact span that caused it. Because observability is built into the framework rather than bolted on as a separate service, the path from zero to full instrumentation is essentially configuration-free.

Mastra Studio is the most direct way to observe your agents during development. It connects to your local Mastra instance and surfaces real-time traces, token usage, latency, and agent decision paths without any additional setup. When you're investigating a quality regression, you can navigate from a trace directly into the logs within it, and run scorers against historical traces from the Observability section without writing extra tooling.

Because Studio shows traces in real time alongside scorer outputs, you can correlate a latency spike with a quality regression in the same view. It also lets non-engineers edit prompts and run scorers against historical traces directly, which shortens the feedback loop between evaluation and iteration.

In production, Mastra's scorer system lets you attach textual, classification, and trajectory scorers to agents and workflows. Scorers run asynchronously alongside live traffic and feed results into your storage backend for trend analysis. For sensitive environments, the SensitiveDataFilter span processor redacts passwords, tokens, and keys from trace data before export. Mastra also plays well with external providers: Langfuse, Datadog, Braintrust, Arize, and any OpenTelemetry-compatible platform are supported through the Observability package.

Here's a minimal observability setup:

import { Mastra } from "@mastra/core/mastra";
 
import {
  Observability,
  MastraStorageExporter,
  SensitiveDataFilter,
} from "@mastra/observability";
 
export const mastra = new Mastra({
  observability: new Observability({
    configs: {
      default: {
        serviceName: "my-agent",
 
        exporters: [new MastraStorageExporter()],
 
        spanOutputProcessors: [new SensitiveDataFilter()],
      },
    },
  }),
});

If your stack is already TypeScript, the zero-configuration path to full observability is the main reason to start here: every agent call, tool invocation, and workflow step is traced automatically, real-time traces sit next to scorer outputs in the same view, and both engineers and non-engineers can iterate on prompts and evals without leaving Mastra Studio.

Portkey

Portkey is an AI gateway for teams routing across multiple model providers. It intercepts LLM calls to add logging, fallback routing, caching, and cost tracking without per-call instrumentation, and supports Anthropic, OpenAI, Google Gemini, and dozens of other providers through a single interface. Its semantic caching returns cached results for semantically similar queries to reduce token spend, and per-provider cost tracking shows where your token budget is going. It runs as separate infrastructure in the model routing path rather than inside your agent framework.

TruLens

TruLens takes an eval-first approach to agent observability. It ships with feedback functions, including faithfulness, relevance, and groundedness scorers, that you attach to any LLM call. For RAG, it scores both the quality of retrieved context and the faithfulness of the generated response relative to that context. It's oriented toward output-quality evaluation rather than infrastructure metrics.

Lunary

Lunary is an open-source option aimed at smaller teams. It supports the major generative AI providers and offers a hosted tier that removes the operational burden of self-hosting while keeping data export open. It also includes prompt management and user analytics, pairing observability with lightweight product instrumentation.

LangSmith

LangSmith is tied to the LangChain and LangGraph ecosystem. For teams on that stack, it traces agent workflows without manual span instrumentation, and its dataset management feeds directly into offline eval pipelines. For teams not using LangChain, that tight coupling is a reason to evaluate other options first.

Getting started

The right platform depends on your team's priorities. If you need full data ownership and customization, start with an open-source tool and invest in the infrastructure to run it. If you need fast time-to-value with minimal ops burden, a managed platform gets you there sooner. Either way, prioritize OpenTelemetry compatibility so you're not locked into a single vendor's trace format.

Define your eval criteria before going to production, and invest in a storage backend that scales with your trace volume. The feedback loops you build between traces, evals, and prompt management are what turn production debugging into systematic improvement.

Challenges of implementing LLM observability

Building an effective LLM observability platform is harder than instrumenting a traditional web service. You'll run into challenges unique to non-deterministic, token-intensive, multi-step systems.

Non-determinism and the difficulty of ground-truth evaluation

You can't write a simple assertion against an LLM's output the way you'd test a REST endpoint. The same prompt may yield different valid responses. Establishing ground truth requires human feedback, LLM-as-judge approaches, or carefully curated evaluation datasets.

This makes regression detection harder. You need statistical methods and scoring distributions rather than binary pass/fail checks.

High data volumes and storage costs at scale

Every model call generates prompt content, response content, token counts, timing data, and metadata. Multiply that by thousands of requests per minute and you're looking at significant storage and query costs. This means you need to make decisions about sampling rates, retention windows, and storage backends early.

Multi-step agent runs and distributed tracing complexity

A single agent run can span dozens of LLM calls, tool invocations, and branching decisions. If your agent delegates to subagents within LangGraph or CrewAI pipelines, each with their own tool sets, the trace tree becomes deeply nested.

Standard distributed tracing captures the structure, but you need UI and query tooling that can surface the relevant spans without drowning you in noise. Agent-aware trace visualization is still an emerging capability in most LLM monitoring tools.

Sensitive data in prompts and responses

Prompts and responses often contain PII, proprietary business data, or regulated content. You need redaction pipelines, access controls, and clear data-retention policies.

This challenge intensifies with agent systems that browse the web, read uploaded documents, or access internal APIs. Input and output guardrails become part of your observability strategy, not just your security strategy. Specifically, you need guardrails that scan for jailbreaks, prompt injection attempts, and toxicity in both directions, before the model and after.

Manual vs. autonomous observability for LLM systems

You have two broad approaches to acting on observability data: human review and automated response. Most production systems need both, applied to different categories of issues.

Human-in-the-loop review workflows

For high-stakes decisions or novel failure modes, you need subject matter experts reviewing production outputs. Platforms that support annotation queues, structured review interfaces where experts label trace samples, make this practical at scale.

The review workflow looks like this:

  • Sample production traces at a defined frequency

  • Route samples to domain experts through a review UI that shows the full trace with less-important details collapsed

  • Experts label each sample with an overall grade, category tags, and optional qualitative feedback

  • Feed labeled data back into eval datasets and re-run benchmarks

Human review provides high-signal human feedback, but it doesn't scale well. Treat it as your ground-truth builder, not your primary quality gate.

Automated alerting, guardrails, and self-healing agents

Automated observability handles the volume that human review cannot. You can set alerts on latency spikes, token budget overruns, error rate increases, and eval score drops.

Guardrails add a proactive layer. Input guardrails intercept prompts before the model processes them, catching prompt injection attempts, PII, and off-topic queries. Output guardrails screen responses for hallucination, data leakage, and toxicity before delivery to the user.

More advanced systems implement self-healing patterns: if an agent step fails, the system retries with modified parameters or falls back to an alternative model. Rate limiting at the routing layer prevents runaway loops from exhausting token budgets before alerts can fire. Design these patterns carefully, aggressive retries without back-off can create cost spikes worse than the original failure.

How to get started with LLM observability

You don't need a fully built LLM observability platform on day one. Start with basic instrumentation and layer on complexity as your system matures.

Instrument your first LLM call

Your first step is capturing structured traces from a single model call. If you're using OpenTelemetry-compatible tooling, create a span that records the prompt, model parameters, response content, token counts, and latency.

import { trace } from "@opentelemetry/api";
const tracer = trace.getTracer("llm-service");
async function tracedModelCall(prompt: string) {
  return tracer.startActiveSpan("llm.chat", async (span) => {
    span.setAttribute("llm.prompt", prompt);
    span.setAttribute("llm.model", "gpt-4o");
    const start = Date.now();
    const response = await model.generate(prompt);
    span.setAttribute("llm.response", response.text);
    span.setAttribute("llm.tokens.input", response.usage.promptTokens);
    span.setAttribute("llm.tokens.output", response.usage.completionTokens);
    span.setAttribute("llm.latency_ms", Date.now() - start);
    span.end();
    return response;
  });
}

This gives you the raw data. From here, you can add spans for tool calls, retrieval steps, and agent decision points.

Define evaluation criteria before going to production

Before you ship, you need to know what "good" looks like. Define your eval criteria based on your use case: factual accuracy for a knowledge agent, tool selection correctness for an agentic workflow, or task completion rate for an end-to-end automation.

Build a small eval dataset (even 20 to 50 hand-curated examples) and run your agent against it in CI. This baseline catches regressions before they reach users and gives you a feedback loop that tightens with each deploy cycle.

Choose a storage and query backend that scales

Your observability data will grow fast. Choose a backend that handles high-throughput ingestion and supports fast analytical queries over large datasets.

Key considerations when evaluating storage options:

  • Write throughput: can it ingest thousands of trace events per second without back-pressure?

  • Query performance: can you filter and aggregate across millions of spans in sub-second time?

  • Compression: columnar formats with good compression reduce storage costs significantly

  • Retention: can you set tiered retention policies for hot vs. cold data?

General-purpose relational databases work for prototyping but tend to struggle at production-scale trace volumes.

Build dashboards and alert on regressions

Once you have data flowing, build dashboards that surface the metrics your team checks daily: p50 and p99 latency, token spend by model, error rates, and eval score trends. Platforms like Langfuse surface these alongside eval scores in a single dashboard, so you can correlate a latency spike with a quality degradation in the same view.

Set alerts on meaningful thresholds, not vanity metrics. A sustained drop in eval scores across a 24-hour window matters more than a single slow response. In practice, alert fatigue tends to undermine observability adoption more than missing data does. The feedback loops you create between alert thresholds and your eval dataset are what separate reactive teams from proactive ones.

Frequently asked questions

What is the difference between LLM monitoring and LLM observability?

LLM monitoring tracks predefined metrics like latency and error rates. LLM observability goes deeper, giving you the ability to ask arbitrary questions about system behavior through traces, logs, evals, and prompt/response capture. Monitoring tells you something is wrong; observability gives you the context to understand why.

Can I use existing APM tools for LLM observability?

Existing APM tools capture infrastructure metrics but miss LLM-specific signals like token usage, prompt content, output quality scoring, and agent decision traces. You can use APM alongside LLM observability tools, but you'll need purpose-built instrumentation for model-level visibility.

How do I handle sensitive data in LLM traces?

Apply redaction at the instrumentation layer before data reaches your storage backend. Define field-level policies for PII, credentials, and proprietary content. Use role-based access controls on your observability platform, and set retention policies that align with your compliance requirements.

What is OpenTelemetry's role in LLM observability?

OpenTelemetry provides the vendor-neutral standard for trace, metric, and log collection. Most LLM observability tools either build on OTel directly or export to OTel-compatible backends. Starting with OTel gives you flexibility to switch platforms without re-instrumenting your application.

How many traces should I sample in production?

Start with 100% capture for low-traffic systems or critical agent workflows. As volume grows, implement tiered sampling: full capture for high-stakes or error-path traces, lower rates for routine successful completions. Adjust based on your storage budget and debugging needs.

Share:
Aron Schuhmann
Aron SchuhmannHead of Demand Generation

Aron Schuhmann is the Head of Demand Generation at Mastra. A career-long B2B SaaS marketer, he has worked at the intersection of AI and developer tools since 2015, serving as an early growth and demand-generation hire at MightyAI (acquired by Uber), Gatsby (acquired by Netlify), and OctoAI (acquired by NVIDIA).

All articles by Aron Schuhmann
Abhi Aiyer

Abhi Aiyer is the founder and CTO of Mastra. Previously, he was a principal engineer at Netlify and Gatsby, where he worked on developer tooling and infrastructure at scale.

All articles by Abhi Aiyer