# jwuthri-cloud/tracely-ai architecture

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

- Interactive diagram: https://gitdiagram.com/jwuthri-cloud/tracely-ai
- Repository: https://github.com/jwuthri-cloud/tracely-ai

## Overview

Tracely turns production agent traces into graded failures, regression cases, CI gate results, and alerts. The main path is OTLP ingestion, online evaluation and failure triage, case promotion and replay, then gate decisions and notifications. The graph also preserves documented analysis, calibration, and conversation views. Some subsystem links come from README descriptions because their implementation was not sampled; those are marked dashed when the code-level caller is not evidenced.

Main entry points: [`backend/tracely/services/ingestion_service.py`](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/ingestion_service.py) (Trace ingestion), [`backend/tracely/workers/tasks.py`](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/workers/tasks.py) (Background tasks), [`backend/tracely/services/evaluation_service.py`](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/evaluation_service.py) (Online evaluation), [`backend/tracely/services/gate_service.py`](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/gate_service.py) (CI gate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Trace ingestion"]
  node_sdk["Tracing SDK<br/>[__init__.py]"]
  node_otlp["OTLP endpoint<br/>[otlp.py]"]
  node_ingest_service["Trace ingestion"]
end

subgraph group_triage["Evaluation and triage"]
  node_evaluation["Online evaluation"]
  node_judge["LLM gateway<br/>[provider.py]"]
  node_score_writer["Evaluation scores<br/>[score_writer.py]"]
  node_failure_intel["Failure clustering"]
end

subgraph group_regression["Regression and gates"]
  node_cases["Regression cases"]
  node_gate["CI gate<br/>[gate_service.py]"]
  node_scenarios["Conversation scenarios"]
end

subgraph group_insights["Product insights"]
  node_monitoring["Alert monitoring"]
  node_alert_flow["Alert flow actions"]
  node_notifications["Notifications<br/>[dispatch.py]"]
  node_analytics["Trends and analysis<br/>[statistics.py]"]
  node_calibration["Judge calibration<br/>[calibration.py]"]
end

subgraph group_platform["API and persistence"]
  node_blob[("Raw trace blobs<br/>[s3.py]")]
  node_worker["Background tasks<br/>[tasks.py]"]
  node_event_store[("Trace event store<br/>[client.py]")]
  node_trace_reader["Trace queries<br/>[trace_reader.py]"]
  node_api["API application<br/>[main.py]"]
  node_repositories[("Workspace registry<br/>[repositories.py]")]
  node_db_models[("Registry models<br/>[models.py]")]
  node_db_engine["Database sessions<br/>[engine.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

node_agent(("Agent workload"))
node_frontend["Product UI<br/>[page.tsx]"]
node_developer(("Developer / CI"))
node_slack_email_webhook["Slack, email, webhook"]

node_agent -->|"emits traces"| node_sdk
node_sdk -.->|"sends OTLP"| node_otlp
node_api -->|"mounts route"| node_otlp
node_otlp -.->|"submits traces"| node_ingest_service
node_ingest_service -->|"stores raw body"| node_blob
node_ingest_service -.->|"enqueues work"| node_worker
node_worker -->|"processes blob"| node_ingest_service
node_ingest_service -->|"writes events"| node_event_store
node_worker -->|"dispatches grading"| node_evaluation
node_evaluation -->|"loads traces"| node_trace_reader
node_evaluation -->|"runs judges"| node_judge
node_evaluation -->|"writes scores"| node_score_writer
node_worker -->|"dispatches triage"| node_failure_intel
node_failure_intel -.->|"promotes failures"| node_cases
node_developer -->|"runs CI gate"| node_gate
node_gate -->|"replays cases"| node_cases
node_gate -->|"runs scenarios"| node_scenarios
node_gate -->|"reports verdict"| node_developer
node_worker -->|"evaluates monitors"| node_monitoring
node_monitoring -->|"fires alert flow"| node_alert_flow
node_alert_flow -.->|"dispatches actions"| node_notifications
node_notifications -->|"delivers alerts"| node_slack_email_webhook
node_frontend -.->|"requests grading"| node_evaluation
node_frontend -.->|"labels verdicts"| node_calibration
node_frontend -.->|"views trends"| node_analytics
node_api -.->|"serves product data"| node_repositories
node_repositories -->|"queries entities"| node_db_models
node_db_engine -.->|"provides sessions"| node_repositories
node_ingest_service -->|"reads settings"| node_config
node_db_engine -->|"configures engines"| node_config

click node_sdk "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/sdk/tracely_sdk/__init__.py"
click node_otlp "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/api/routers/otlp.py"
click node_ingest_service "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/ingestion_service.py"
click node_blob "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/blob/s3.py"
click node_worker "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/workers/tasks.py"
click node_event_store "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/clickhouse/client.py"
click node_trace_reader "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/clickhouse/trace_reader.py"
click node_evaluation "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/evaluation_service.py"
click node_judge "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/llm/provider.py"
click node_score_writer "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/clickhouse/score_writer.py"
click node_failure_intel "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/failure_intel_service.py"
click node_cases "https://github.com/jwuthri-cloud/Tracely-ai/tree/main/backend/tracely/domain/regression"
click node_gate "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/gate_service.py"
click node_scenarios "https://github.com/jwuthri-cloud/Tracely-ai/tree/main/backend/tracely/domain/simulation"
click node_monitoring "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/monitoring_service.py"
click node_alert_flow "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/alert_flow_service.py"
click node_notifications "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/notifications/dispatch.py"
click node_analytics "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/domain/analysis/statistics.py"
click node_calibration "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/domain/evaluation/calibration.py"
click node_api "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/api/main.py"
click node_repositories "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/db/repositories.py"
click node_db_models "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/db/models.py"
click node_db_engine "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/db/engine.py"
click node_config "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/config.py"
click node_frontend "https://github.com/jwuthri-cloud/Tracely-ai/blob/main/frontend/app/(app)/traces/page.tsx"

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_sdk,node_otlp,node_ingest_service,node_frontend toneBlue
class node_evaluation,node_judge,node_score_writer,node_failure_intel toneAmber
class node_cases,node_gate,node_scenarios,node_slack_email_webhook toneMint
class node_monitoring,node_alert_flow,node_notifications,node_analytics,node_calibration toneRose
class node_blob,node_worker,node_event_store,node_trace_reader,node_api,node_repositories,node_db_models,node_db_engine,node_config,node_agent,node_developer toneIndigo
```

## Components

### Trace ingestion

- [Tracing SDK](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/sdk/tracely_sdk/__init__.py): `sdk/tracely_sdk/__init__.py`
- [OTLP endpoint](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/api/routers/otlp.py): `backend/tracely/api/routers/otlp.py`
- [Trace ingestion](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/ingestion_service.py): `backend/tracely/services/ingestion_service.py`

### Evaluation and triage

- [Online evaluation](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/evaluation_service.py): `backend/tracely/services/evaluation_service.py`
- [LLM gateway](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/llm/provider.py): `backend/tracely/infrastructure/llm/provider.py`
- [Evaluation scores](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/clickhouse/score_writer.py): `backend/tracely/infrastructure/clickhouse/score_writer.py`
- [Failure clustering](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/failure_intel_service.py): `backend/tracely/services/failure_intel_service.py`

### Regression and gates

- [Regression cases](https://github.com/jwuthri-cloud/Tracely-ai/tree/main/backend/tracely/domain/regression): `backend/tracely/domain/regression`
- [CI gate](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/gate_service.py): `backend/tracely/services/gate_service.py`
- [Conversation scenarios](https://github.com/jwuthri-cloud/Tracely-ai/tree/main/backend/tracely/domain/simulation): `backend/tracely/domain/simulation`

### Product insights

- [Alert monitoring](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/monitoring_service.py): `backend/tracely/services/monitoring_service.py`
- [Alert flow actions](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/services/alert_flow_service.py): `backend/tracely/services/alert_flow_service.py`
- [Notifications](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/notifications/dispatch.py): `backend/tracely/infrastructure/notifications/dispatch.py`
- [Trends and analysis](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/domain/analysis/statistics.py): `backend/tracely/domain/analysis/statistics.py`
- [Judge calibration](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/domain/evaluation/calibration.py): `backend/tracely/domain/evaluation/calibration.py`

### API and persistence

- [Raw trace blobs](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/blob/s3.py): `backend/tracely/infrastructure/blob/s3.py`
- [Background tasks](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/workers/tasks.py): `backend/tracely/workers/tasks.py`
- [Trace event store](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/clickhouse/client.py): `backend/tracely/infrastructure/clickhouse/client.py`
- [Trace queries](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/clickhouse/trace_reader.py): `backend/tracely/infrastructure/clickhouse/trace_reader.py`
- [API application](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/api/main.py): `backend/tracely/api/main.py`
- [Workspace registry](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/db/repositories.py): `backend/tracely/infrastructure/db/repositories.py`
- [Registry models](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/db/models.py): `backend/tracely/infrastructure/db/models.py`
- [Database sessions](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/infrastructure/db/engine.py): `backend/tracely/infrastructure/db/engine.py`
- [Runtime settings](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/backend/tracely/config.py): `backend/tracely/config.py`

### Other components

- **Agent workload**
- [Product UI](https://github.com/jwuthri-cloud/Tracely-ai/blob/main/frontend/app/(app)/traces/page.tsx): `frontend/app/(app)/traces/page.tsx`
- **Developer / CI**
- **Slack, email, webhook**

## Connections

- Agent workload → Tracing SDK: emits traces (evidence: `README.md`)
- Tracing SDK → OTLP endpoint: sends OTLP (evidence: `README.md`)
- API application → OTLP endpoint: mounts route (evidence: `backend/tracely/api/main.py`)
- OTLP endpoint → Trace ingestion: submits traces
- Trace ingestion → Raw trace blobs: stores raw body (evidence: `backend/tracely/infrastructure/blob/s3.py`)
- Trace ingestion → Background tasks: enqueues work (evidence: `backend/tracely/services/ingestion_service.py`)
- Background tasks → Trace ingestion: processes blob (evidence: `backend/tracely/workers/tasks.py`)
- Trace ingestion → Trace event store: writes events (evidence: `backend/tracely/services/ingestion_service.py`)
- Background tasks → Online evaluation: dispatches grading (evidence: `backend/tracely/workers/tasks.py`)
- Online evaluation → Trace queries: loads traces (evidence: `backend/tracely/services/evaluation_service.py`)
- Online evaluation → LLM gateway: runs judges (evidence: `backend/tracely/services/evaluation_service.py`)
- Online evaluation → Evaluation scores: writes scores (evidence: `backend/tracely/services/evaluation_service.py`)
- Background tasks → Failure clustering: dispatches triage (evidence: `backend/tracely/workers/tasks.py`)
- Failure clustering → Regression cases: promotes failures (evidence: `README.md`)
- Developer / CI → CI gate: runs CI gate (evidence: `README.md`)
- CI gate → Regression cases: replays cases (evidence: `backend/tracely/services/gate_service.py`)
- CI gate → Conversation scenarios: runs scenarios (evidence: `backend/tracely/services/gate_service.py`)
- CI gate → Developer / CI: reports verdict (evidence: `README.md`)
- Background tasks → Alert monitoring: evaluates monitors (evidence: `backend/tracely/workers/tasks.py`)
- Alert monitoring → Alert flow actions: fires alert flow (evidence: `backend/tracely/services/monitoring_service.py`)
- Alert flow actions → Notifications: dispatches actions (evidence: `README.md`)
- Notifications → Slack, email, webhook: delivers alerts (evidence: `README.md`)
- Product UI → Online evaluation: requests grading (evidence: `README.md`)
- Product UI → Judge calibration: labels verdicts (evidence: `README.md`)
- Product UI → Trends and analysis: views trends (evidence: `README.md`)
- API application → Workspace registry: serves product data
- Workspace registry → Registry models: queries entities (evidence: `backend/tracely/infrastructure/db/repositories.py`)
- Database sessions → Workspace registry: provides sessions
- Trace ingestion → Runtime settings: reads settings (evidence: `backend/tracely/services/ingestion_service.py`)
- Database sessions → Runtime settings: configures engines (evidence: `backend/tracely/infrastructure/db/engine.py`)
