# dsx-ai-factory/run-ai architecture

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

- Interactive diagram: https://gitdiagram.com/dsx-ai-factory/run-ai
- Repository: https://github.com/dsx-ai-factory/run-ai

## Overview

NVIDIA Run:ai is a Kubernetes-based AI workload and GPU orchestration platform. Its principal flow starts with a user submitting a workload through the web UI, CLI, or REST API; the control plane manages and governs that request, cluster services synchronize it, and cluster-side scheduling runs it. Status and metrics return to centralized observability. The repository spans a large monorepo, so unsampled capabilities are represented at documented subsystem-directory level; sampled source confirms selected inference, storage-class, metrics, and cluster-controller responsibilities.

Main entry points: [`control-plane/workloads`](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/workloads) (Workload APIs), [`runai-cluster/cluster/cluster-sync/pkg/controllers`](https://github.com/dsx-ai-factory/run-ai/tree/main/runai-cluster/cluster/cluster-sync/pkg/controllers) (Cluster synchronization), [`control-plane/cluster-service`](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/cluster-service) (Cluster management), [`runai-cluster/cluster/workload-controller`](https://github.com/dsx-ai-factory/run-ai/tree/main/runai-cluster/cluster/workload-controller) (Workload controllers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_web["Web UI"]
  node_cli["CLI"]
  node_rest["REST APIs"]
end

subgraph group_management["Control plane"]
  node_workloadapi["Workload APIs"]
  node_assetapi["Asset and inference APIs"]
  node_composer["Workload composer"]
  node_authorization["Authorization"]
  node_policy["Policies and quotas"]
  node_org["Organization and resources"]
  node_cluster_service["Cluster management"]
  node_storage_api["Storage-class API"]
  node_database[("Control-plane data")]
end

subgraph group_cluster["Cluster execution"]
  node_sync["Cluster synchronization"]
  node_scheduler["GPU-aware scheduling"]
  node_workload_controller["Workload controllers"]
  node_exporter["Workload metrics exporter"]
end

subgraph group_insight["Monitoring and governance"]
  node_metrics_query["Metrics queries"]
  node_metrics_store["Metric stores<br/>[manager.go]"]
  node_audit["Audit logging"]
end

node_user(("User / system"))

node_user -->|"operates"| node_web
node_user -->|"submits through"| node_cli
node_user -->|"calls"| node_rest
node_web -->|"submits workloads"| node_workloadapi
node_cli -->|"submits workloads"| node_workloadapi
node_rest -->|"manages workloads"| node_workloadapi
node_workloadapi -.->|"composes requests"| node_composer
node_workloadapi -->|"checks access"| node_authorization
node_workloadapi -->|"enforces policies"| node_policy
node_workloadapi -.->|"persists state"| node_database
node_assetapi -->|"creates inference"| node_workloadapi
node_cluster_service -->|"synchronizes requests"| node_sync
node_sync -->|"dispatches workload events"| node_workload_controller
node_workload_controller -->|"runs workloads"| node_scheduler
node_scheduler -->|"schedules on cluster resources"| node_user
node_sync -->|"returns workload status"| node_cluster_service
node_sync -->|"reports storage classes"| node_storage_api
node_workload_controller -->|"exposes workload metrics"| node_exporter
node_exporter -.->|"publishes metrics"| node_metrics_store
node_metrics_query -->|"queries metrics"| node_metrics_store
node_cluster_service -.->|"serves cluster analytics"| node_metrics_query
node_authorization -->|"governs resource access"| node_org
node_user -->|"activity is recorded"| node_audit

click node_web "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/frontend"
click node_cli "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/runai-cli"
click node_rest "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane"
click node_workloadapi "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/workloads"
click node_assetapi "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/assets-service/pkg/services"
click node_composer "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/workloads-and-policies/composer"
click node_authorization "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/authorization"
click node_policy "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/workloads-and-policies"
click node_org "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/org-unit-service"
click node_cluster_service "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/cluster-service"
click node_storage_api "https://github.com/dsx-ai-factory/run-ai/blob/main/control-plane/k8s-objects-tracker/pkg/services/api_storage_classes_service.go"
click node_database "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/assets-service/pkg/database"
click node_sync "https://github.com/dsx-ai-factory/run-ai/tree/main/runai-cluster/cluster/cluster-sync/pkg/controllers"
click node_scheduler "https://github.com/dsx-ai-factory/run-ai/tree/main/runai-cluster"
click node_workload_controller "https://github.com/dsx-ai-factory/run-ai/tree/main/runai-cluster/cluster/workload-controller"
click node_exporter "https://github.com/dsx-ai-factory/run-ai/blob/main/runai-cluster/cluster/workload-exporter/pkg/controller/workload/distributed_inference_workload_controller.go"
click node_metrics_query "https://github.com/dsx-ai-factory/run-ai/blob/main/control-plane/cluster-service/pkg/services/query_metrics_service.go"
click node_metrics_store "https://github.com/dsx-ai-factory/run-ai/blob/main/control-plane/metrics-service/internal/metricstores/manager.go"
click node_audit "https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/audit-service"

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_web,node_cli,node_rest,node_user toneBlue
class node_workloadapi,node_assetapi,node_composer,node_authorization,node_policy,node_org,node_cluster_service,node_storage_api,node_database toneAmber
class node_sync,node_scheduler,node_workload_controller,node_exporter toneMint
class node_metrics_query,node_metrics_store,node_audit toneRose
```

## Components

### User interfaces

- [Web UI](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/frontend): `control-plane/frontend`
- [CLI](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/runai-cli): `control-plane/runai-cli`
- [REST APIs](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane): `control-plane`

### Control plane

- [Workload APIs](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/workloads): `control-plane/workloads`
- [Asset and inference APIs](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/assets-service/pkg/services): `control-plane/assets-service/pkg/services`
- [Workload composer](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/workloads-and-policies/composer): `control-plane/workloads-and-policies/composer`
- [Authorization](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/authorization): `control-plane/authorization`
- [Policies and quotas](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/workloads-and-policies): `control-plane/workloads-and-policies`
- [Organization and resources](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/org-unit-service): `control-plane/org-unit-service`
- [Cluster management](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/cluster-service): `control-plane/cluster-service`
- [Storage-class API](https://github.com/dsx-ai-factory/run-ai/blob/main/control-plane/k8s-objects-tracker/pkg/services/api_storage_classes_service.go): `control-plane/k8s-objects-tracker/pkg/services/api_storage_classes_service.go`
- [Control-plane data](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/assets-service/pkg/database): `control-plane/assets-service/pkg/database`

### Cluster execution

- [Cluster synchronization](https://github.com/dsx-ai-factory/run-ai/tree/main/runai-cluster/cluster/cluster-sync/pkg/controllers): `runai-cluster/cluster/cluster-sync/pkg/controllers`
- [GPU-aware scheduling](https://github.com/dsx-ai-factory/run-ai/tree/main/runai-cluster): `runai-cluster`
- [Workload controllers](https://github.com/dsx-ai-factory/run-ai/tree/main/runai-cluster/cluster/workload-controller): `runai-cluster/cluster/workload-controller`
- [Workload metrics exporter](https://github.com/dsx-ai-factory/run-ai/blob/main/runai-cluster/cluster/workload-exporter/pkg/controller/workload/distributed_inference_workload_controller.go): `runai-cluster/cluster/workload-exporter/pkg/controller/workload/distributed_inference_workload_controller.go`

### Monitoring and governance

- [Metrics queries](https://github.com/dsx-ai-factory/run-ai/blob/main/control-plane/cluster-service/pkg/services/query_metrics_service.go): `control-plane/cluster-service/pkg/services/query_metrics_service.go`
- [Metric stores](https://github.com/dsx-ai-factory/run-ai/blob/main/control-plane/metrics-service/internal/metricstores/manager.go): `control-plane/metrics-service/internal/metricstores/manager.go`
- [Audit logging](https://github.com/dsx-ai-factory/run-ai/tree/main/control-plane/audit-service): `control-plane/audit-service`

### Other components

- **User / system**

## Connections

- User / system → Web UI: operates
- User / system → CLI: submits through
- User / system → REST APIs: calls
- Web UI → Workload APIs: submits workloads
- CLI → Workload APIs: submits workloads (evidence: `control-plane/runai-cli/internal/controlplane/api/submit/storage.go`)
- REST APIs → Workload APIs: manages workloads (evidence: `control-plane/workloads-and-policies/composer/fields_composer_storage.go`)
- Workload APIs → Workload composer: composes requests (evidence: `control-plane/workloads-and-policies/composer/fields_composer_storage.go`)
- Workload APIs → Authorization: checks access (evidence: `control-plane/workloads/pkg/services_crud/inferences_service.go`)
- Workload APIs → Policies and quotas: enforces policies (evidence: `control-plane/workloads-and-policies/composer/fields_composer_storage.go`)
- Workload APIs → Control-plane data: persists state
- Asset and inference APIs → Workload APIs: creates inference (evidence: `control-plane/assets-service/pkg/services/api_inference_service.go`)
- Cluster management → Cluster synchronization: synchronizes requests
- Cluster synchronization → Workload controllers: dispatches workload events (evidence: `runai-cluster/cluster/cluster-sync/pkg/controllers/distributed_inference_controller.go`)
- Workload controllers → GPU-aware scheduling: runs workloads (evidence: `runai-cluster/cluster/cluster-sync/pkg/controllers/distributed_inference_controller.go`)
- GPU-aware scheduling → User / system: schedules on cluster resources
- Cluster synchronization → Cluster management: returns workload status
- Cluster synchronization → Storage-class API: reports storage classes
- Workload controllers → Workload metrics exporter: exposes workload metrics (evidence: `runai-cluster/cluster/workload-exporter/pkg/controller/workload/distributed_inference_workload_controller.go`)
- Workload metrics exporter → Metric stores: publishes metrics
- Metrics queries → Metric stores: queries metrics (evidence: `control-plane/cluster-service/pkg/services/query_metrics_service.go`)
- Cluster management → Metrics queries: serves cluster analytics (evidence: `control-plane/cluster-service/pkg/services/query_metrics_service.go`)
- Authorization → Organization and resources: governs resource access
- User / system → Audit logging: activity is recorded
