queryAnalytics, over the MCP connection. You ask your agent for a dashboard;
the agent makes a handful of queryAnalytics calls and renders a self-contained HTML page from the
results. Latitude provides the data; the agent renders it.
The shape of every widget
Every chart is the same three-part query over a filtered stream:- Metric — the number each row reduces to (
count,errorRate,percentile(duration),avg(cost), …). - Breakdown — the dimension to split across, one row per value (by
model,tool,signalId, …). - Time bucket — optional granularity (
hour/day/week) that turns a number into a trend.
errorRate × breakdown model × bucket week. Swap any
axis for the next chart — no new endpoint.
Streams and metrics
| Stream | What it measures | Metrics | Break down by |
|---|---|---|---|
traces / sessions / spans | requests, conversations, operations | count, errorRate, cacheHitRate, sum/min/max/avg/median of duration|cost|tokens, plus percentile ({ kind: "percentile", field, p }, p 1–99) | model, provider, service, tool, tag, status (+ name/userId on traces, operation on spans) |
scores (signals) | scored occurrences | count, passRate, errorRate, avg/min/max/median of value | signalId, source, model, provider, service, tool, tag |
behaviors | clustered behaviors | count, avg/min/max/median of confidence | cluster, session, method |
moments | labeled conversation moments | count, avg/min/max/median of confidence|coherence | kind, actor, session |
duration in seconds, cost in dollars, and rates
(errorRate, cacheHitRate, passRate) as a 0–1 fraction.
Example calls
[{ key?, bucketStart?, value }] — small enough to embed inline no matter
how many traces it spans.
Row-level widgets
For a “top 10 slowest tool calls” style table (rows, not an aggregate), usequerySpans to list the
individual spans across traces:
Rendering
The agent embeds the returned series directly into a self-contained HTML file (an inline chart library, data baked in) and commits it to your repo or hosts it wherever you like. Nothing is rendered by Latitude — which keeps the data portable and the setup dependency-free. A good prompt is simply: “Build a self-contained HTML dashboard of this project’s LLM reliability and cost over the last 30 days.” The agent discovers the rightqueryAnalytics calls on its own.
See Agent dispatch for the investigation counterpart —
how an agent uses these same tools to root-cause a signal.