Introduction
In our last lesson, we mastered the art of instrumenting our agent workflows with OpenTelemetry, creating detailed, replayable traces for individual tasks. We learned to enrich these traces with critical metadata like token counts and cost estimates, providing the granular data needed for deep debugging. This gave us an unparalleled view of the "trees"—the execution path of a single agent run.
Today, we shift our perspective to monitoring the entire "forest." While individual traces are essential for dissecting failures, a production system requires a high-level, aggregate view of its health and performance. In this lesson, we will focus on how to design a monitoring dashboard to track key agent performance indicators (KPIs) and error rates. We will explore how to transform the rich data from our traces into meaningful metrics, and how to visualize them in a way that provides instant, actionable insights into your agent fleet's operational efficiency, cost, and behavioral patterns.
From Traces to Metrics: The Foundation of Monitoring
In the world of observability, traces, metrics, and logs form a powerful triad.
- Traces, as we saw, detail the story of a single request's journey.
- Logs provide verbose, event-specific context.
- Metrics are numerical summaries of data aggregated over time. They are the lifeblood of dashboards, providing the time-series data needed to plot graphs, calculate rates, and set alerts.
The attributes we meticulously embedded in our OpenTelemetry spans are not just for debugging individual traces; they are the raw material for generating powerful metrics. For example, the agent.total_llm_tokens attribute on your agent.session span can be aggregated to calculate the total token consumption across all agents per minute. The agent.tool.status attribute can be used to compute the error rate for each tool.
This transformation from trace data to metrics is often handled by a component in the observability pipeline, such as the OpenTelemetry Collector or directly within the observability backend itself.

Given your background in distributed systems, you'll recognize this as a standard pattern for decoupling data collection from data analysis, a cornerstone of scalable monitoring.
Designing the Dashboard: What Should We Measure?
The most critical step in designing a dashboard is identifying the right Key Performance Indicators (KPIs). For an agentic system, these KPIs fall into three primary categories: Performance & Reliability, Cost & Resource Consumption, and Agent Behavior & Quality.
The structured trace data we designed in the previous lessons is precisely what enables us to answer critical questions in each of these domains.
How to Trace Multi-Step Agent Workflows with OpenTelemetry Sessions and Spans
This article provides an excellent summary of the kinds of high-value questions that can be answered once your agent is properly instrumented.
Please read the section titled "Useful Queries for Debugging." As you read, notice how each question maps directly to an attribute we defined for our spans (e.g., agent.tool.status, agent.total_llm_tokens, agent.total_steps). This section perfectly illustrates the link between instrumentation and monitoring.
Let's formalize these questions into a set of core KPIs for our dashboard.
1. Performance & Reliability KPIs
These metrics tell you if your system is available and responsive. They are the first things you look at when a problem is suspected.
- Request Rate (Throughput): The number of agent sessions initiated per second or minute. A sudden drop could indicate an upstream issue or a deployment failure.
- End-to-End Session Latency: The duration of the entire
agent.sessionspan. Tracking the 50th, 90th, and 99th percentiles (p50, p90, p99) is crucial. A rising p99 latency indicates that your longest-running tasks are getting slower, often a precursor to wider problems. - Error Rate: The percentage of agent sessions that terminate with a status of
error. This is arguably the single most important health metric. It should be broken down further:- Error Rate by Type: Are failures happening in the
agent.thinkstep (LLM issues),agent.tool_call(external service issues), or elsewhere? - Error Rate by Tool: Which specific tools are the most frequent sources of failure?
- Error Rate by Type: Are failures happening in the
2. Cost & Resource Consumption KPIs
For any system using powerful LLMs, cost is a primary operational concern.
- Total Token Consumption: Sum of
llm.usage.total_tokensover time. This should be tracked closely to monitor spend. - Estimated Cost (USD): Sum of
llm.cost_estimated_usd. This translates token usage into direct financial impact. - Cost per Session/Task: The average cost of a single agent run. You can calculate this by
SUM(llm.cost_estimated_usd) / COUNT(agent.session spans). - Cost Breakdown by Model: A bar chart showing cost attributed to different models (
llm.model) can help optimize model selection.
3. Agent Behavior & Quality KPIs
These metrics provide insight into the effectiveness and efficiency of your agents' reasoning.
- Average Steps per Session: The average value of the
agent.total_stepsattribute. A rising number of steps for the same task type could indicate the agent is becoming less efficient, getting stuck in loops, or struggling with a complex problem. - Tool Usage Distribution: A chart showing the invocation frequency of each tool (
agent.tool.name). This helps identify the most critical tools and those that are rarely used. - Task Completion Status: A stacked bar chart showing the distribution of final session statuses:
completed,error,max_steps_exceeded. A high rate ofmax_steps_exceededis a strong signal that agent logic needs refinement.
Visualizing the KPIs: Dashboard Layout
With our KPIs defined, we can now design the dashboard layout. A good dashboard tells a story, starting with a high-level summary and allowing the user to drill down into details. Open-source tools like Grafana are industry standards for this.

Let's break down the structure of an effective agent monitoring dashboard, using the image above as a model:
-
Summary Row (The "Big Numbers"): At the very top, display the most critical current KPIs as single numbers.
- Examples:
Request Rate,Total Usage Tokens,Avg Usage Cost,Total Usage Cost. These provide an immediate health check.
- Examples:
-
Core Time-Series Graphs: The next section should contain line graphs showing the evolution of key metrics over time.
- Examples:
Cost Trend Analysis,Request Success Rate,P95 Session Latency. This is where you spot trends, spikes, and dips.
- Examples:
-
Distribution Histograms: Histograms are excellent for understanding the spread of your data, not just the average.
- Examples:
Request Duration Distribution,Response Time Distribution by Token Size. A bimodal distribution in latency, for instance, might reveal two distinct classes of tasks (fast and slow) that should be analyzed separately.
- Examples:
-
Categorical Breakdowns: Use bar charts or tables to group metrics by different dimensions.
- Examples:
Request Rate by Model,Top GenAI Models by Usage,Tool Error Rate by Name. This is invaluable for pinpointing the source of issues or cost drivers.
- Examples:
A key feature of a modern dashboard is interactivity. A user should be able to click on a spike in the error rate graph and be taken directly to a list of the failed traces from that time period, bridging the gap between macro-monitoring and micro-debugging.
The Technology in Action
Building such a dashboard involves a stack of technologies working in concert. While the exact tools can vary, a common and powerful open-source stack consists of Prometheus (a time-series database for metrics) and Grafana (a visualization and dashboarding tool).
The workflow is as follows:
- Your instrumented agent sends trace data to an OTel Collector.
- The collector processes this data, generates metrics (e.g., counts, histograms), and exports them to Prometheus.
- Grafana is configured with Prometheus as a data source and used to build dashboards by writing queries in PromQL (Prometheus Query Language).
The following videos demonstrate what these dashboards look like in practice, both in a simple open-source setup and a polished enterprise environment.
How to Deploy LLMs | LLMOps Stack with vLLM, Docker, Grafana & MLflow
This video showcases a hands-on LLMOps stack, including a Grafana dashboard for monitoring an LLM. It gives a great feel for a real-time monitoring UI.
Watch the short segment from the dashboard demo. Notice the key performance metrics being tracked in real-time: time to first token, request latency, and token throughput. This illustrates the live, operational nature of a performance dashboard.
While the previous video shows a basic setup, large-scale systems use more comprehensive, integrated solutions. The principles, however, remain the same.
AgentCore Observability: Monitor and Debug AI Agents with OpenTelemetry | AWS Show and Tell
This AWS presentation on AgentCore Observability demonstrates a production-grade monitoring solution for AI agents. It highlights how to create custom dashboards and leverage metrics for deep analysis.
First, watch the overview of the out-of-the-box dashboards to see what a comprehensive solution provides. Then, focus on the section about creating custom dashboards. The speaker discusses building visualizations for latency, token usage, and setting up alarms—directly aligning with our KPI design. Finally, see how you can query specific logs, demonstrating the link between aggregate metrics and detailed log data.
These practical examples show how the KPIs we defined are not merely theoretical but are the building blocks of real-world operational monitoring for agentic systems.
Conclusion
In this lesson, we elevated our observability strategy from the microscopic level of individual traces to the macroscopic view of a monitoring dashboard. We established that the foundation of a good dashboard is a well-defined set of KPIs, which in turn are derived from the rich, structured data we instrumented within our OpenTelemetry spans.
Key Takeaways:
- Dashboards are powered by metrics: Metrics are numerical aggregates (e.g., counts, averages, rates) derived from trace and log data, stored in time-series databases like Prometheus.
- Define KPIs across key domains: A robust agent monitoring strategy must track Performance (latency, errors), Cost (tokens, USD), and Behavior (steps, tool usage).
- Design dashboards for intuitive analysis: Structure your dashboard logically, from high-level summaries down to detailed breakdowns, to quickly guide you from problem detection to root cause.
- The goal is actionable insight: The dashboard should not just display data; it should enable you to answer critical operational questions and, ideally, link you directly to the underlying trace data for deep debugging.
Preview of the Next Lesson:
You have now completed all the core modules of this course, from structured LLM interaction and the agent loop to advanced reasoning, state management, reliability patterns, and finally, observability. You are equipped with the first-principles knowledge to engineer production-grade agentic systems.
In the final module, our capstone, you will bring all these pieces together. You will design the end-to-end architecture for a scalable, asynchronous agent system, integrating orchestration, reliability, and observability components into a single, cohesive design. This will be your opportunity to synthesize everything you've learned into a blueprint for a real-world, production-ready agentic service.