Skip to content

[docs]: Add Agent Analytics design dashboard - #5648

Open
ashrafchowdury wants to merge 10 commits into
mainfrom
docs/new-agent-analytcis-dhasboard
Open

[docs]: Add Agent Analytics design dashboard#5648
ashrafchowdury wants to merge 10 commits into
mainfrom
docs/new-agent-analytcis-dhasboard

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

Context

We want a project-scoped Analytics page in the web app that charts how a project's agents perform over a time window: run volume, success and failure, latency, cost, and token usage. Before writing any UI code, this PR lands the design workspace that scopes the page, maps the code it will reuse, and pins the data contract. It adds documentation only. No web/ or api/ code changes.

Changes

A new docs/design/agent-analytics/ workspace with a fixed reading order:

  • context.md : why the page exists, what a user sees today, goals and non-goals, and the three locked scope decisions.
  • research.md : the existing code the page reuses, with exact file paths (the analytics fetch layer, the response-to-dashboard mapper, sidebar and routing, the charting library). The key finding: the data path from POST /spans/analytics/query to a mapped dashboard shape already exists for the Observability page, so this feature reuses that spine rather than adding a new data layer.
  • data-contract.md : the request the page sends (time window, filter, metric specs) and the response fields it reads, including the fields today's mapper drops that this page needs (the prompt/completion cost and token split, and duration min/max/p95).
  • plan.md : the build split into phases, with the file list per phase and the boundary where the deferred Models and Tools views drop in once the backend supports them.
  • status.md : source of truth for progress. Records the locked decisions, the open questions per phase, and what is deferred to a later backend change (Tools chart, Models chart, per-model cost).
  • README.md : the entry point and glossary.

The scope is deliberately frontend-first: four charts, four stat tiles, a browser-computed health donut, an Agents filter, and a time-range control, with no api/ change. A 2026-08-02 code-verification pass confirmed the endpoint already returns everything the in-scope charts need, so passing explicit metric specs is a two-line entities-layer change, not new plumbing.

Notes

  • Docs only. Nothing to run or QA; no user-visible change.
  • Implementation happens on a separate branch; this PR is the plan, not the code.

Deisgn preview

Summary

Total 3 sections

  1. A summary section for a quick view of what's happening - useful for the people who don't understand the analytics stuff that much. = In scope for v1
  2. 4 Charts (runs, latency, token, costs) = in v1 scope; we already have it on the frontend
  3. 2 charts (tool usage, model usage) = out of scope for v1, required backend changes

In short: No backend changes required for the first iteration

…mentation

- Introduced the Analytics page to visualize agent performance metrics.
- Created context, data contract, plan, research, and status documentation for the new feature.
- Ensured the new page reuses existing data-fetching mechanisms without altering the backend.
…s, refine glossary terms, and enhance data contract details
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Aug 2, 2026
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 4, 2026 11:14am

Request Review

@dosubot dosubot Bot added the documentation Improvements or additions to documentation label Aug 2, 2026
@ashrafchowdury
ashrafchowdury requested a review from mmabrouk August 2, 2026 11:23
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Added comprehensive design documentation for a project-scoped Agent Analytics dashboard.
    • Defined planned charts for runs, latency, cost, tokens, harnesses, configured models, and agents.
    • Documented time-range, agent, harness, and model filtering, metric definitions, data contracts, and page states.
    • Outlined implementation phases, validation guidance, coverage requirements, backend prerequisites, and deferred functionality.
    • Added an evidence-based review of analytics capabilities, limitations, performance considerations, and staged rollout recommendations.

Walkthrough

Added seven design documents for a project-scoped Agent Analytics page. The documents define page scope, backend capabilities, analytics contracts, chart behavior, implementation phases, deferred backend work, validation, and unresolved questions.

Changes

Agent Analytics

Layer / File(s) Summary
Page scope and terminology
docs/design/agent-analytics/README.md, docs/design/agent-analytics/context.md, docs/design/agent-analytics/scope.md, docs/design/agent-analytics/status.md
Defines project scope, filters, chart scope, glossary, v1 and v2 boundaries, locked decisions, and non-goals.
Backend capability and product boundaries
docs/design/agent-analytics/capability-review.md, docs/design/agent-analytics/plan.md
Documents endpoint behavior, supported metrics, filtering and failure semantics, data coverage, performance limits, prerequisites, and staged delivery boundaries.
Analytics contract and data flow
docs/design/agent-analytics/data-contract.md, docs/design/agent-analytics/research.md, docs/design/agent-analytics/status.md
Specifies request parameters, metric mappings, failed-run queries, bucket handling, response mapping, coverage gating, state reuse, and validation constraints.
Implementation phases and deferred views
docs/design/agent-analytics/plan.md, docs/design/agent-analytics/context.md, docs/design/agent-analytics/research.md, docs/design/agent-analytics/data-contract.md
Defines route and sidebar integration, chart delivery, page states, deferred Tools and Models views, backend prerequisites, extension points, and testing requirements.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the documentation change for the Agent Analytics design dashboard.
Description check ✅ Passed The description accurately explains the documentation-only Agent Analytics design workspace, planned v1 scope, reused analytics infrastructure, and deferred backend work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/new-agent-analytcis-dhasboard

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ashrafchowdury

Copy link
Copy Markdown
Contributor Author

Let me know your thoguhts @mmabrouk

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c6d17e97-baab-493b-a6b2-554de3f419cc

📥 Commits

Reviewing files that changed from the base of the PR and between 7c395db and ea530f5.

📒 Files selected for processing (6)
  • docs/design/agent-analytics/README.md
  • docs/design/agent-analytics/context.md
  • docs/design/agent-analytics/data-contract.md
  • docs/design/agent-analytics/plan.md
  • docs/design/agent-analytics/research.md
  • docs/design/agent-analytics/status.md

Comment thread docs/design/agent-analytics/data-contract.md Outdated
Comment thread docs/design/agent-analytics/plan.md Outdated
Comment thread docs/design/agent-analytics/plan.md Outdated
Comment thread docs/design/agent-analytics/README.md Outdated
Comment thread docs/design/agent-analytics/status.md Outdated
@mmabrouk

mmabrouk commented Aug 2, 2026

Copy link
Copy Markdown
Member

…ytics backend

The design workspace in this PR plans the Analytics page on the assumption that the
backend already answers everything the first release needs, and that no backend change
is required. This adds an independent review that tests that assumption against the
running code.

The review answers the two framing questions (how analytics works today, and how the
three mounted routes and two implementations differ), then takes each wanted capability
one at a time with a verdict, the exact request that produces it, and the live probe that
proved or disproved it. It ends with measured latency, a scale projection, the frontend
requirements, and a v1 and v2 proposal.

Findings that change the plan:

- Six of the fourteen wanted capabilities work today and mean what the wish list assumes.
  Four work only under a narrower label, such as "configured model" rather than the model
  that answered. Four are not available today at any price.
- The query engine is more capable than the plan assumes. It summarizes any JSON path,
  returns 27 percentiles on any numeric metric, and returns a per-value frequency table
  per bucket on any categorical metric. Three capabilities the plan defers work today.
- The plan's failed-run filter is rejected by the backend and returns an empty success,
  so the page would report perfect health on a project with a 9.5% failure rate.
- The cost chart reads JSON paths that hold no data on either dataset measured. A
  different path does hold cost, and its coverage fell from about 70% of runs to near
  zero in mid-July on both datasets. The cause is unknown and is the top open item.
- A 30-day query takes 1.7 seconds at today's volume, and a query killed by timeout
  returns HTTP 200 with an empty result rather than an error. Seven days costs 0.26
  seconds and should be the default window.

Evidence: every claim carries a file:line citation or a live probe result. Probes ran
against two local development stacks; no production data was queried, so coverage
percentages are unverified on production traffic. Raw probe payloads and query plans are
not committed; Appendix A indexes them.

Docs only. No code changes.

Claude-Session: https://claude.ai/code/session_01RkWWQUNNzRbaB5jnCAdjYA
@mmabrouk

mmabrouk commented Aug 2, 2026

Copy link
Copy Markdown
Member

I pushed docs/design/agent-analytics/capability-review.md to this branch (commit 61b43e9), plus one pointer line in the README.

It is an independent capability review of the analytics backend, written after your four documents and tested against the running code. Every claim carries either a file:line citation or a live query result. Probes ran against two local development stacks, so the coverage percentages are unverified on production traffic; the capability claims come from code plus live calls and hold on any dataset.

Where it agrees with your plan: the spine you picked is right. POST /spans/analytics/query is the correct endpoint, the existing fetch layer and mapper are the right things to reuse, and passing explicit metric specs really is a small change.

Where it disagrees, and why the plan needs a revision before implementation starts:

  1. The failed-run filter in data-contract.md is rejected by the backend. It returns an empty success rather than an error, so the health donut would show 100% on a project measured at a 9.5% failure rate. The corrected filter is in section 4.4 item 6.
  2. The cost chart reads JSON paths that hold no data. A different, unmapped path does hold cost. Its coverage fell from roughly 70% of runs to near zero in mid-July on both datasets measured. Cause unknown; that is the top open item in the review.
  3. Three charts you deferred to a later backend release work today. Model usage, harness usage, and per-value breakdowns all come back from one categorical/single spec, which returns a frequency table per bucket.
  4. Two charts you kept are proxies, not the thing named. The endpoint can return the first configured tool of a run, not which tools ran, and the author's model alias, not which model answered. A chart titled "Tool usage" fed by that path would be wrong.
  5. Performance sets the real limit. A 30-day window takes 1.7 seconds at today's volume, and a query killed by timeout returns HTTP 200 with an empty result instead of an error. Seven days costs 0.26 seconds. The review recommends seven days as the default.

Section 8 has a v1 that stays within the existing backend and a v2 with the backend work in order. Section 7 lists the metric-meaning decisions that need an answer before anyone writes code.

I did not edit plan.md or status.md, since those are yours. They currently say no backend change is required for v1, and the review names two backend prerequisites, so they will need an update.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/design/agent-analytics/README.md (1)

39-42: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Exclude annotation traces from the documented run metric.

This glossary defines a run as an agent invocation but equates run count with ag.type.trace. The capability review states that this metric also includes annotation traces unless filtered. Document the required trace_type is invocation filter, or qualify the metric definition. Otherwise run volume and derived health values can include non-agent traces.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: de39af7a-39f6-4acf-abd7-500c5cf51bab

📥 Commits

Reviewing files that changed from the base of the PR and between ea530f5 and 61b43e9.

📒 Files selected for processing (2)
  • docs/design/agent-analytics/README.md
  • docs/design/agent-analytics/capability-review.md

Comment thread docs/design/agent-analytics/capability-review.md
Comment thread docs/design/agent-analytics/capability-review.md
- Updated the plan to clarify backend prerequisites for Phase 0, including distinguishing between empty results and failures in API responses.
- Enhanced Phase 1 details to specify the structure of analytics queries and the validation process for metrics.
- Revised Phase 3 to include specific state management for the analytics page and ensure proper handling of loading and empty states.
- Expanded Phase 4 to detail the summary panel and chart requirements, including coverage-gated metrics and responsive design considerations.
- Clarified the definitions of failed runs and health scores in the status documentation, ensuring consistency with backend expectations.
- Added details on the necessary data paths and metrics for the new analytics page, emphasizing the need for coverage-gated data due to previous collapses.
- Documented open questions and risks to address during the build process, focusing on validation of metrics and response handling.
- Updated the plan.md to clarify the cost chart and token split coverage collapse investigation.
- Enhanced research.md to detail the analytics fetch layer and response-to-dashboard mapper.
- Introduced scope.md to delineate features for v1 and v2, including backend prerequisites.
- Revised status.md to reflect current planning status and locked decisions, emphasizing frontend-first scope and backend dependencies.
- Improved clarity and consistency across documentation, ensuring alignment with implementation goals.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 12


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5069ca29-2b3d-4025-b811-b652a21125fd

📥 Commits

Reviewing files that changed from the base of the PR and between 61b43e9 and 244b8ca.

📒 Files selected for processing (7)
  • docs/design/agent-analytics/README.md
  • docs/design/agent-analytics/context.md
  • docs/design/agent-analytics/data-contract.md
  • docs/design/agent-analytics/plan.md
  • docs/design/agent-analytics/research.md
  • docs/design/agent-analytics/scope.md
  • docs/design/agent-analytics/status.md

Comment thread docs/design/agent-analytics/context.md Outdated
Comment thread docs/design/agent-analytics/context.md Outdated
Comment thread docs/design/agent-analytics/context.md Outdated
Comment thread docs/design/agent-analytics/data-contract.md Outdated
Comment thread docs/design/agent-analytics/data-contract.md Outdated
Comment thread docs/design/agent-analytics/README.md Outdated
Comment thread docs/design/agent-analytics/README.md Outdated
Comment thread docs/design/agent-analytics/scope.md Outdated
Comment thread docs/design/agent-analytics/scope.md Outdated
Comment thread docs/design/agent-analytics/status.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/design/agent-analytics/data-contract.md (1)

191-199: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Specify the coverage threshold and zero-run behavior.

coverage clears a threshold is not an implementable rule. Define the formula, numeric threshold, scope of the calculation, and the result when the window has zero runs. Otherwise clients can make different availability decisions or calculate an invalid ratio.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a5dc396-3925-4181-89a9-420831ff139f

📥 Commits

Reviewing files that changed from the base of the PR and between 244b8ca and 032358e.

📒 Files selected for processing (5)
  • docs/design/agent-analytics/context.md
  • docs/design/agent-analytics/data-contract.md
  • docs/design/agent-analytics/plan.md
  • docs/design/agent-analytics/scope.md
  • docs/design/agent-analytics/status.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/design/agent-analytics/status.md
  • docs/design/agent-analytics/scope.md
  • docs/design/agent-analytics/plan.md

Comment thread docs/design/agent-analytics/data-contract.md Outdated
Comment thread docs/design/agent-analytics/data-contract.md Outdated
Comment thread docs/design/agent-analytics/data-contract.md Outdated
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2d3d5d50-9dc5-4a3e-aa1d-e55aaa2574bd

📥 Commits

Reviewing files that changed from the base of the PR and between 032358e and ebf33fe.

📒 Files selected for processing (3)
  • docs/design/agent-analytics/plan.md
  • docs/design/agent-analytics/scope.md
  • docs/design/agent-analytics/status.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/design/agent-analytics/status.md
  • docs/design/agent-analytics/plan.md

Comment thread docs/design/agent-analytics/scope.md Outdated
…tatus sections

- Revised the research section to clarify the analytics engine's functionality and the data path from endpoint to dashboard.
- Updated the scope document to delineate features for v1 and v2, emphasizing backend dependencies and capabilities.
- Removed the status document as its content is now integrated into the scope and research sections, reflecting the current state of development and decisions made.
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Aug 4, 2026
@ashrafchowdury

Copy link
Copy Markdown
Contributor Author

@mmabrouk I have added everything related to scopes to the scope.md file.

And in my words: I would not ship v1 before fixing some cretical issues on the v2, if we want to ship v1 one as it's now, then we only would have 2 fully working metric charts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants