Why Agent Observability Isn't Optional
You've shipped your first AI agent to production. It worked in your notebook. The evals passed. Then the first customer ran it against their data, and it went sideways—took 45 seconds instead of 5, burned $200 in tokens on a single request, or returned nonsense because it hallucinated a tool parameter.
You have no idea why.
Traditional logging won't help. You can't grep your way through a reasoning loop. Metrics dashboards show you that something broke, not why. And by the time you've spun up a debugger, the user's already lost faith in the system.
This is the observability gap that kills most agent projects before they scale. Unlike stateless APIs, AI agents are reasoning systems. They make decisions across multiple steps, call external tools, retry on failure, and accumulate context. Each of those decisions is invisible without the right instrumentation.
Agent observability isn't a nice-to-have. It's the difference between a system you can operate and one that operates you.
At Brightlume, we've shipped production AI agents across financial services, healthcare, and hospitality. The teams that hit their 90-day targets and maintain sub-100ms latency under load all have one thing in common: they built observability in from day one. Not as an afterthought. Not as a monitoring layer bolted on top. As part of the agent's DNA.
This guide walks you through the observability stack you actually need—not the marketing stack, the real stack. We'll cover what to instrument, how to instrument it, and how to use that data to debug, optimise, and scale.
The Three Pillars of Agent Observability
Agent observability rests on three pillars: traces, evals, and telemetry. They're distinct, but they work together.
Traces are the execution history of a single agent run. They show you the reasoning path: which tools were called, in what order, with what inputs and outputs, and how long each step took. Traces are your primary debugging tool. When an agent fails, a trace tells you exactly where and why.
Evals are automated checks that measure whether an agent's output meets your requirements. Did it return the right answer? Did it stay within budget? Did it avoid the security guardrail you set? Evals are your quality gates. They tell you when something's degraded before users notice.
Telemetry is the aggregate data you collect across all runs: latency percentiles, token spend, error rates, tool success rates, model drift. Telemetry is your early warning system. It shows you trends, anomalies, and systemic issues that traces alone can't surface.
Most teams try to do observability with just one pillar. Traces without evals means you can see what happened but not whether it was right. Evals without traces means you know something failed but not why. Telemetry without either means you're flying blind.
You need all three.
Instrumenting Traces: What to Capture
A trace is a directed acyclic graph (DAG) of spans. Each span represents a discrete unit of work: a model call, a tool invocation, a decision point. The spans are connected by parent-child relationships that show the execution flow.
Here's what a minimal agent trace looks like:
- Root span: The entire agent run. Start time, end time, total cost, whether it succeeded.
- Model call span: The LLM invocation. Which model, which prompt, token count (input and output), latency, temperature, top-k settings.
- Tool call span: Each tool invocation. Tool name, input parameters, output, latency, whether it succeeded or failed.
- Decision span: Where the agent chose to retry, escalate, or terminate. The reasoning (if available) and the outcome.
The key insight: you don't need to trace everything, but you need to trace the decision path. If your agent calls Claude Opus 4 to generate a summary, then uses that summary to call a database, you need spans for both the model call and the database call. You don't need a span for every line of Python that runs between them.
Most modern agent frameworks—LangGraph, CrewAI, AWS Bedrock Agents—have built-in tracing support. OpenTelemetry semantic conventions for AI agents are emerging as the standard. If you're building a custom agent, use OpenTelemetry. If you're using a framework, check whether it supports OpenTelemetry natively or whether you need an adapter.
Specific fields to capture in each span:
For model calls:
- Model name and version (e.g.,
claude-opus-4,gpt-4-turbo) - Prompt tokens and completion tokens (separately)
- Total cost (model-specific, calculated at ingest)
- Latency (time-to-first-token and total time)
- Temperature, top-p, max-tokens settings
- Whether the output was truncated
- The first 500 characters of the prompt and completion (for debugging, stripped of PII)
For tool calls:
- Tool name and version
- Input parameters (schema and values, masked if sensitive)
- Output (first 500 characters, masked if sensitive)
- Latency (time spent waiting for the tool)
- Whether it succeeded or failed
- Error type and message (if failed)
- Number of retries (if applicable)
For decision spans:
- The decision type (retry, escalate, terminate, continue)
- The reason (if available from the model's reasoning)
- The outcome (what happened as a result)
One critical detail: sample your traces. If you're running 100,000 agent invocations per day, you can't afford to store all of them. Sample at 10% in production, 100% in staging. Use stratified sampling so you capture failures (which are rare) at a higher rate than successes.
Building Evals: Measuring What Matters
Evals are automated tests that run on agent outputs. They answer specific questions: Did the agent accomplish its goal? Did it stay within cost bounds? Did it avoid hallucinating?
Evals come in three flavours: deterministic, heuristic, and LLM-based.
Deterministic evals check for exact matches or rule-based conditions. Example: "Did the agent return a valid JSON object?" or "Did it call the approval tool before updating the database?" These are cheap to run and reliable, but they only work for well-defined, narrow criteria.
Heuristic evals use statistical methods to check for patterns. Example: "Did the agent's response contain any of these banned keywords?" or "Is the response length within 10% of the expected range?" These catch more subtle issues, but they're prone to false positives and false negatives.
LLM-based evals use a separate language model to judge the output. Example: "Is this response helpful and accurate?" scored on a 1–5 scale. These are flexible and can handle nuance, but they're expensive (you're paying for another model call) and only as good as your eval prompt.
For production agents, you need all three. Here's a concrete example from a financial services agent we shipped:
- Deterministic: Did the agent return a structured response with required fields (account_id, action, amount, reason)? Did it log the decision to the audit trail?
- Heuristic: Is the requested amount within the customer's daily limit? Is the response latency under 10 seconds?
- LLM-based: Is the explanation for the decision clear and justified? Would a compliance officer accept this reasoning?
Evals should run in two places: in your CI/CD pipeline (on test data) and in production (on real requests, sampled). In CI/CD, they're part of your quality gate. In production, they're your early warning system.
When an eval fails, it should trigger an alert and log the full trace for that request. This is how you catch regressions before they affect SLAs.
One more detail: version your evals. When you change an eval, you've changed your quality bar. You need to know which runs were evaluated with which version so you can compare apples to apples over time.
Telemetry: The Aggregate Picture
Traces and evals are point-in-time data. Telemetry is the aggregate. It's the percentiles, trends, and anomalies that emerge when you look across thousands of runs.
Key metrics to track:
Performance metrics:
- P50, P95, P99 latency (total and per-step)
- Time-to-first-token (for streaming agents)
- Tool success rate (how often tool calls succeeded on the first try)
- Retry rate (how often the agent had to re-run a step)
Cost metrics:
- Total tokens per run (input + output)
- Cost per run (model-specific)
- Cost per successful outcome (cost divided by number of completed tasks)
- Cost trend (is cost per run increasing or decreasing over time?)
Quality metrics:
- Eval pass rate (percentage of runs that passed all evals)
- Eval pass rate by eval type (which evals are failing most often?)
- User satisfaction (if you have feedback data)
- Error rate (percentage of runs that failed completely)
Model-specific metrics:
- Which models are being used (if you have multiple)
- Model performance comparison (latency, cost, quality per model)
- Token distribution (are you hitting max-token limits?)
Tool-specific metrics:
- Tool call frequency (which tools are called most often?)
- Tool success rate (which tools fail most often?)
- Tool latency (which tools are bottlenecks?)
These metrics should be visualised in a dashboard that your team checks daily. When a metric moves, you should know why. If latency jumps from 3 seconds to 8 seconds, you need to drill down: Did the model change? Did a tool slow down? Did retry rate increase?
Comprehensive guides on AI agent observability cover how to structure telemetry pipelines. The key is to make it queryable. You should be able to ask: "Show me all runs where latency was >10 seconds and the database tool was called" in under a second.
The Observability Stack in Practice
Let's walk through a real scenario. You're operating an AI agent that processes insurance claims. It reads a claim, extracts key information, checks policy coverage, and either approves or escalates to a human.
A customer reports that their claim took 2 minutes to process instead of the usual 30 seconds. Here's how observability helps:
Step 1: Check telemetry. Your dashboard shows that latency spiked at 14:32 UTC. P95 latency jumped from 35 seconds to 120 seconds. Tool success rate for the "check_coverage" tool dropped from 99% to 87%. Hypothesis: the coverage database was slow or failing.
Step 2: Sample traces. You pull traces from the spike window. You see that 40% of runs had a "check_coverage" tool call that timed out after 30 seconds, then retried. The second attempt succeeded. That's where the extra 90 seconds went.
Step 3: Check evals. Your "audit_trail_logged" eval failed for 15% of runs during the spike. The agent was so busy retrying that it skipped logging some decisions. This is a compliance issue.
Step 4: Investigate the root cause. You check the coverage database logs and find that a query was running slow due to a missing index. You add the index, latency returns to normal, eval pass rate recovers.
Without observability, you'd have only known that "claims are slow." With observability, you diagnosed and fixed the issue in 20 minutes.
This is why observability matters. It's the difference between operating blind and operating with full visibility.
Implementing Observability: The Technical Stack
You have three options: build it yourself, use a framework's built-in observability, or use a specialised observability platform.
Building it yourself: You write code to capture spans, calculate metrics, store them in a time-series database (Prometheus, InfluxDB), and query them with a tool like Grafana. This is flexible but time-consuming. You're responsible for sampling, retention, cost management. Only do this if you have a dedicated observability engineer.
Framework observability: Most modern agent frameworks have observability built in. LangGraph has native tracing support. CrewAI logs agent decisions. AWS Bedrock Agents integrate with CloudWatch. If you're using one of these, start there. It's free and it works.
Specialised platforms: Tools like Langfuse, Datadog, Arthur, and Weights & Biases offer purpose-built observability for AI agents. They handle sampling, cost calculation, eval management, and alerting. They cost money, but they save time. Langfuse, for example, integrates with LangGraph and OpenAI Agents and gives you a UI for exploring traces and running evals.
Our recommendation: start with your framework's built-in observability. If you outgrow it (which usually happens around 1M requests/month), migrate to a specialised platform. Don't build observability infrastructure yourself unless you have no other choice.
Observability and Security
One critical constraint: observability can leak sensitive data. If you're tracing an agent that processes healthcare records or financial data, your traces can't contain the actual data.
You need a masking strategy. Before you send a trace to your observability platform, strip PII:
- Patient names, medical record numbers, diagnoses → masked
- Account numbers, transaction amounts, customer names → masked
- API keys, passwords, tokens → never logged
Mask at ingest time, not at query time. Once data is in your logs, it's too late.
For more details on how to handle sensitive data in production agents, read our guide on AI agent security.
This ties into broader compliance and audit trail requirements. Your observability system should double as your audit log. Every agent decision should be traceable, timestamped, and immutable.
Observability for Multi-Agent Systems
If you're running multiple agents in orchestration, observability gets more complex. You need to trace not just individual agents, but the interactions between them.
Here's the pattern:
- Root trace: The entire workflow (e.g., "process insurance claim")
- Agent traces: Each agent's execution (e.g., "extract claim info", "check coverage", "calculate payout")
- Inter-agent communication: Messages passed between agents, decisions made by one agent that trigger another
Use distributed tracing to connect these. Each agent run should carry a trace ID that links it back to the root workflow. This way, when something fails, you can see the entire dependency chain.
OpenTelemetry supports this natively. If you're using a framework, check whether it propagates trace context across agent boundaries.
Observability and Model Evaluation
Evals are especially important when you're using multiple models or switching models. You need to know whether a new model is actually better.
Here's the rigorous approach:
- Establish a baseline. Run your current agent (with your current model) on a fixed test set. Calculate eval pass rates, latency, cost.
- Run the new model. Run the same test set with the new model.
- Compare. Did quality improve? Did latency improve? Did cost improve? Or did something regress?
Don't just look at aggregate metrics. Stratify by eval type. Maybe the new model is better at reasoning but worse at following format constraints. Maybe it's faster but more expensive. You need the breakdown.
This is where best practices for building agents with observability become critical. Without good observability, you can't do rigorous model evaluation. You're just guessing.
Observability and Cost Control
AI agents are expensive. Every model call costs money. Every tool invocation costs latency (and often money). Without observability, costs spiral.
Here's how observability helps:
Identify token waste. Your telemetry shows that the average agent run uses 8,000 tokens. You drill into traces and find that 40% of that is prompt overhead—context that's not being used effectively. You optimise the prompt, drop to 5,000 tokens. That's a 37% cost reduction.
Catch runaway retries. An agent that's supposed to call a tool once is calling it five times. Telemetry shows retry rate at 400%. Traces show that the tool keeps returning malformed output. You fix the tool, retry rate drops to 5%.
Optimise model selection. You're using Claude Opus 4 for every decision, but telemetry shows that 70% of decisions are straightforward. You switch those to Claude Haiku, keep Opus for complex reasoning. Cost drops 60%, latency improves.
Cost control is a direct function of observability. You can't optimise what you can't measure.
Observability and Incident Response
When an agent fails in production, you need to respond fast. Observability is your incident response toolkit.
Triage. When a user reports an issue, pull the trace for that specific request. You have the full execution history in 30 seconds. This beats traditional debugging by hours.
Scope. Check telemetry to see how many other requests were affected. Is this an isolated incident or a systemic issue? How long has it been happening?
Root cause. Traces show you exactly where the failure occurred. Did the model fail? Did a tool fail? Did the agent make a bad decision?
Remediation. Once you know the cause, you can fix it. Roll back a model change, patch a tool, adjust agent parameters.
Post-incident. Add an eval to catch this specific failure in the future. Update your runbooks. Share findings with the team.
This entire cycle—triage to post-incident—is only possible with good observability.
Observability and Continuous Improvement
Observability isn't just for debugging. It's your feedback loop for continuous improvement.
Here's the pattern:
- Baseline. You measure current performance: latency, cost, quality.
- Hypothesis. You think of an improvement: better prompt, smarter tool selection, different model.
- Experiment. You run the improvement on a subset of traffic.
- Measure. You compare evals, telemetry, and traces between the baseline and the experiment.
- Decide. If the improvement wins on your metrics, you roll it out. If not, you try something else.
Without observability, you're flying blind. With it, you're running a tight feedback loop. This is how you go from a 70% success rate to 95%. Not in one big redesign, but in dozens of small, measured improvements.
Building Your Observability Roadmap
Don't try to instrument everything at once. Build observability incrementally.
Phase 1 (Week 1-2): Traces. Instrument your agent to emit traces for every model call and tool invocation. Get the execution history working. Use your framework's built-in support or OpenTelemetry.
Phase 2 (Week 3-4): Basic evals. Add deterministic evals: Does the output have the right structure? Did the agent call the required tools? Did it avoid banned keywords?
Phase 3 (Week 5-6): Telemetry. Start collecting aggregate metrics: latency percentiles, token counts, cost per run, eval pass rates. Build a dashboard.
Phase 4 (Week 7+): Advanced evals. Add heuristic and LLM-based evals. Measure quality, not just structure.
This roadmap assumes you're shipping in 90 days. If you have more time, you can move slower. If you have less, focus on traces and basic evals. You can add telemetry later.
Observability for Different Agent Types
Observability needs vary by agent type. Here's how to tailor it:
Agentic workflows (autonomous agents): Heavy emphasis on traces and decision points. You need to see every decision the agent made, why it made it, and whether it was right. When comparing agentic AI vs copilots, observability is the key differentiator—autonomous agents require perfect visibility.
Code-writing agents: Focus on traces and execution outcomes. Did the generated code run? Did it produce the right output? For agents that write and execute code, you need to trace both the code generation and the code execution.
Chatbots and copilots: Lighter observability. You care about latency and user satisfaction, less about decision tracing. Unlike full AI agents, chatbots have simpler observability needs.
Workflow automation: Heavy emphasis on cost and reliability. You need to know when automations fail and why. When automating workflows with agents, you're often replacing manual processes, so reliability is non-negotiable.
Observability for Specific Domains
Different industries have different observability requirements.
Healthcare: You need full audit trails, PII masking, and compliance with HIPAA. For agentic health workflows, every decision must be traceable and defensible. Observability doubles as your compliance system.
Financial services: You need cost control (every token costs money), audit trails (regulatory requirement), and latency (customers expect fast decisions). Compliance and audit trails are critical.
Hospitality: You care about latency (guests expect instant responses), cost (you're running at scale), and user satisfaction. For hotel AI transformation, observability helps you optimise guest experience in real time.
Common Observability Mistakes
We've seen teams make these mistakes repeatedly. Don't.
Mistake 1: Logging instead of tracing. Teams log agent decisions to a file, then try to reconstruct the execution flow. This doesn't work. Use structured tracing. It's designed for this.
Mistake 2: Too many evals. Teams add 50 evals and can't keep up with failures. Start with 3–5 critical evals. Add more as you scale.
Mistake 3: No sampling. Teams try to store every trace and run out of storage or budget. Sample from day one. You don't need 100% of data to debug most issues.
Mistake 4: Observability without action. Teams build beautiful dashboards, then don't act on the data. Observability is only useful if it drives decisions. Set up alerts. Establish runbooks. Make it part of your incident response.
Mistake 5: Observability without security. Teams log sensitive data and then wonder why compliance is upset. Mask PII at ingest. Treat your observability system as carefully as your production database.
Observability and the 90-Day Timeline
At Brightlume, we ship production AI systems in 90 days. Observability isn't an afterthought—it's part of the spec from day one.
Here's how it fits into the timeline:
- Days 1–30: Agent design and development. Observability is built in as you code. By day 30, you have traces and basic evals.
- Days 30–60: Tuning and optimisation. You use telemetry to identify bottlenecks and cost drivers. You run A/B tests on prompts and models.
- Days 60–90: Hardening and rollout. You add advanced evals, tighten SLAs, prepare runbooks. You're ready for production.
This is only possible because observability is woven in from the start. If you try to bolt it on at day 75, you'll fail.
Our AI-native engineering approach means observability is part of the culture, not a compliance checkbox. Every engineer knows how to read a trace. Every decision is backed by data.
Observability and Scaling
As your agent scales from 100 requests/day to 100,000, observability becomes even more critical.
At 100 requests/day: You can debug every failure manually. Observability is nice-to-have.
At 10,000 requests/day: You need automated alerts. You can't manually review every failure. Observability is necessary.
At 100,000 requests/day: You need predictive observability. You need to catch issues before they affect users. Observability is your competitive advantage.
The teams that scale successfully are the ones that invested in observability early. They have the data to make decisions. They have the alerts to catch issues. They have the runbooks to respond fast.
Getting Started
You don't need to build a perfect observability system on day one. Start simple:
- Pick a framework or platform. Use your agent framework's built-in observability or a specialised platform like Langfuse. Don't build from scratch.
- Instrument traces. Capture model calls, tool calls, and decision points. Make sure you can see the execution flow.
- Add basic evals. Create 3–5 evals that measure what matters: Does it work? Does it stay in budget? Does it avoid breaking rules?
- Build a dashboard. Visualise latency, cost, and eval pass rate. Check it daily.
- Set up alerts. When latency spikes or eval pass rate drops, get notified.
- Iterate. Use the data to improve your agent. Run experiments. Measure results. Ship updates.
This is the observability stack that actually works. Not the one in the marketing slides, but the one that lets you operate production AI systems with confidence.
If you're building production AI agents and want help shipping them in 90 days with full observability, explore our capabilities. We've built the patterns that work.
Observability isn't optional. It's how you go from shipping a prototype to operating a system.