# ritzraven19/agent-run-explorer architecture

> Architecture diagram of the GitHub repository ritzraven19/agent-run-explorer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ritzraven19/agent-run-explorer
- Repository: https://github.com/ritzraven19/agent-run-explorer

## Overview

Agent Run Explorer lets people find runs, inspect individual executions, stream a deterministic explanation, and view dataset-wide statistics. The main path is browser → Next.js pages → HTTP API → in-memory JSONL records, with filtering, sorting and pagination for lists and separate statistics aggregation for the dashboard. Detail pages fetch full runs; explanations are streamed directly from the browser to the API. The API also validates models and reports data-quality warnings. The README documents the storage and product capabilities; unsampled frontend helper and warning-display internals are represented at subsystem level.

Main entry points: [`backend/app/main.py`](https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/main.py) (FastAPI routes), [`backend/app/models.py`](https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/models.py) (Run and response models), [`frontend/lib/api.ts`](https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/lib/api.ts) (Frontend API client), [`frontend/app/runs/page.tsx`](https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/app/runs/page.tsx) (Runs pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Web experience"]
  node_runs_pages["Runs pages<br/>[page.tsx]"]
  node_run_detail["Run detail page<br/>[page.tsx]"]
  node_run_components["Run views and filters"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_charts["Dashboard charts"]
  node_api_client["Frontend API client<br/>[api.ts]"]
end

subgraph group_api["API orchestration"]
  node_api_service["FastAPI routes<br/>[main.py]"]
end

subgraph group_domain["Run data"]
  node_jsonl[("JSONL run data<br/>[runs.jsonl]")]
  node_loader["Data loading and warnings<br/>[data.py]"]
  node_run_models["Run and response models<br/>[models.py]"]
end

subgraph group_analytics["Filtering and analytics"]
  node_filters["Run filtering and paging<br/>[filters.py]"]
  node_stats["Run statistics<br/>[stats.py]"]
end

subgraph group_explain["Run explanations"]
  node_explain_provider["Mock explanation provider<br/>[explain.py]"]
end

node_browser(("Browser user"))

node_browser -->|"opens runs"| node_runs_pages
node_browser -->|"opens dashboard"| node_dashboard
node_runs_pages -->|"fetches stats"| node_api_client
node_runs_pages -->|"renders"| node_run_components
node_run_detail -->|"fetches run"| node_api_client
node_run_detail -->|"renders"| node_run_components
node_dashboard -->|"fetches stats"| node_api_client
node_dashboard -->|"renders"| node_charts
node_api_client -->|"HTTP requests"| node_api_service
node_browser -->|"streams explanation request"| node_api_service
node_api_service -->|"loads at startup"| node_loader
node_loader -->|"reads records"| node_jsonl
node_loader -->|"validates records"| node_run_models
node_api_service -->|"validates responses"| node_run_models
node_api_service -->|"queries runs"| node_filters
node_api_service -->|"aggregates stats"| node_stats
node_api_service -->|"streams explanation"| node_explain_provider
node_filters -->|"uses run types"| node_run_models
node_stats -->|"uses run types"| node_run_models
node_explain_provider -->|"describes run"| node_run_models

click node_runs_pages "https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/app/runs/page.tsx"
click node_run_detail "https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/app/runs/%5Bid%5D/page.tsx"
click node_run_components "https://github.com/ritzraven19/agent-run-explorer/tree/main/frontend/components"
click node_dashboard "https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/app/dashboard/page.tsx"
click node_charts "https://github.com/ritzraven19/agent-run-explorer/tree/main/frontend/components/charts"
click node_api_client "https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/lib/api.ts"
click node_api_service "https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/main.py"
click node_jsonl "https://github.com/ritzraven19/agent-run-explorer/blob/main/data/runs.jsonl"
click node_loader "https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/data.py"
click node_run_models "https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/models.py"
click node_filters "https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/filters.py"
click node_stats "https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/stats.py"
click node_explain_provider "https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/explain.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runs_pages,node_run_detail,node_run_components,node_dashboard,node_charts,node_api_client,node_browser toneBlue
class node_api_service toneAmber
class node_jsonl,node_loader,node_run_models toneMint
class node_filters,node_stats toneRose
class node_explain_provider toneIndigo
```

## Components

### Web experience

- [Runs pages](https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/app/runs/page.tsx): `frontend/app/runs/page.tsx`
- [Run detail page](https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/app/runs/%5Bid%5D/page.tsx): `frontend/app/runs/[id]/page.tsx`
- [Run views and filters](https://github.com/ritzraven19/agent-run-explorer/tree/main/frontend/components): `frontend/components`
- [Dashboard](https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/app/dashboard/page.tsx): `frontend/app/dashboard/page.tsx`
- [Dashboard charts](https://github.com/ritzraven19/agent-run-explorer/tree/main/frontend/components/charts): `frontend/components/charts`
- [Frontend API client](https://github.com/ritzraven19/agent-run-explorer/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### API orchestration

- [FastAPI routes](https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/main.py): `backend/app/main.py`

### Run data

- [JSONL run data](https://github.com/ritzraven19/agent-run-explorer/blob/main/data/runs.jsonl): `data/runs.jsonl`
- [Data loading and warnings](https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/data.py): `backend/app/data.py`
- [Run and response models](https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/models.py): `backend/app/models.py`

### Filtering and analytics

- [Run filtering and paging](https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/filters.py): `backend/app/filters.py`
- [Run statistics](https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/stats.py): `backend/app/stats.py`

### Run explanations

- [Mock explanation provider](https://github.com/ritzraven19/agent-run-explorer/blob/main/backend/app/explain.py): `backend/app/explain.py`

### Other components

- **Browser user**

## Connections

- Browser user → Runs pages: opens runs (evidence: `README.md`)
- Browser user → Dashboard: opens dashboard (evidence: `README.md`)
- Runs pages → Frontend API client: fetches stats (evidence: `frontend/app/runs/page.tsx`)
- Runs pages → Run views and filters: renders (evidence: `frontend/app/runs/page.tsx`)
- Run detail page → Frontend API client: fetches run (evidence: `frontend/app/runs/[id]/page.tsx`)
- Run detail page → Run views and filters: renders (evidence: `frontend/app/runs/[id]/page.tsx`)
- Dashboard → Frontend API client: fetches stats (evidence: `frontend/app/dashboard/page.tsx`)
- Dashboard → Dashboard charts: renders (evidence: `frontend/app/dashboard/page.tsx`)
- Frontend API client → FastAPI routes: HTTP requests (evidence: `README.md`)
- Browser user → FastAPI routes: streams explanation request (evidence: `README.md`)
- FastAPI routes → Data loading and warnings: loads at startup (evidence: `backend/app/main.py`)
- Data loading and warnings → JSONL run data: reads records (evidence: `README.md`)
- Data loading and warnings → Run and response models: validates records (evidence: `backend/app/data.py`)
- FastAPI routes → Run and response models: validates responses (evidence: `backend/app/main.py`)
- FastAPI routes → Run filtering and paging: queries runs (evidence: `backend/app/main.py`)
- FastAPI routes → Run statistics: aggregates stats (evidence: `backend/app/main.py`)
- FastAPI routes → Mock explanation provider: streams explanation (evidence: `backend/app/main.py`)
- Run filtering and paging → Run and response models: uses run types (evidence: `backend/app/filters.py`)
- Run statistics → Run and response models: uses run types (evidence: `backend/app/stats.py`)
- Mock explanation provider → Run and response models: describes run (evidence: `backend/app/explain.py`)
