# keras-team/kinetic architecture

> Architecture diagram of the GitHub repository keras-team/kinetic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keras-team/kinetic
- Repository: https://github.com/keras-team/kinetic

## Overview

Kinetic runs Keras/JAX functions remotely on cloud accelerators and exposes synchronous and detached-job workflows. Users configure a profile and provision a cluster, then submit decorated functions; Kinetic packages code and data, builds or selects a container, dispatches Kubernetes work, and collects results and logs. Async jobs and collections add polling, reattachment, and fan-out. The README also documents durable outputs and checkpoints. Relationships below follow the README and SOURCE INDEX references; unsampled implementation details are not assumed.

Main entry points: [`kinetic/backend/execution.py`](https://github.com/keras-team/kinetic/blob/main/kinetic/backend/execution.py) (Execution backend), [`kinetic/jobs.py`](https://github.com/keras-team/kinetic/blob/main/kinetic/jobs.py) (Job handles), [`kinetic/cli/infra/program.py`](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/program.py) (Cloud resources), [`kinetic/cli/main.py`](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/main.py) (CLI entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Remote execution"]
  node_decorator["Run decorator<br/>[core.py]"]
  node_execution["Execution backend<br/>[execution.py]"]
  node_runner["Remote runner<br/>[remote_runner.py]"]
  node_container["Container builder"]
  node_accelerators["Accelerator registry<br/>[accelerators.py]"]
  node_gke["GKE job client<br/>[gke_client.py]"]
  node_pathways["Pathways client<br/>[pathways_client.py]"]
  node_k8s["Kubernetes utilities<br/>[k8s_utils.py]"]
end

subgraph group_jobs["Jobs and data"]
  node_jobsapi["Job handles<br/>[jobs.py]"]
  node_collections["Async collections<br/>[collections.py]"]
  node_data["Data inputs<br/>[data.py]"]
  node_storage["Cloud Storage<br/>[storage.py]"]
  node_logs["Log streaming<br/>[log_streaming.py]"]
end

subgraph group_infra["Infrastructure management"]
  node_state["Infrastructure state<br/>[state.py]"]
  node_stack["Stack manager<br/>[stack_manager.py]"]
  node_program["Cloud resources<br/>[program.py]"]
  node_statebackend[("State backend<br/>[state_backend.py]")]
end

subgraph group_cli["CLI configuration"]
  node_cli["CLI entry point<br/>[main.py]"]
  node_init["Cluster setup<br/>[init.py]"]
  node_up["Provision cluster<br/>[up.py]"]
  node_profiles[("Profiles<br/>[profiles.py]")]
end

node_user(("User"))
node_gcs[("Google Cloud Storage")]
node_cluster["GKE cluster"]
node_acceleratorservice["Cloud accelerators"]

node_user -->|"decorates function"| node_decorator
node_decorator -->|"submits work"| node_execution
node_execution -->|"builds image"| node_container
node_execution -->|"uploads artifacts"| node_storage
node_execution -->|"dispatches jobs"| node_gke
node_execution -->|"dispatches jobs"| node_pathways
node_execution -.->|"resolves hardware"| node_accelerators
node_gke -->|"uses utilities"| node_k8s
node_pathways -->|"builds pod volumes"| node_k8s
node_gke -->|"streams logs"| node_logs
node_pathways -->|"streams logs"| node_logs
node_decorator -->|"returns handle"| node_jobsapi
node_jobsapi -->|"manages jobs"| node_gke
node_jobsapi -->|"manages jobs"| node_pathways
node_jobsapi -->|"collects results"| node_storage
node_collections -->|"tracks children"| node_jobsapi
node_user -->|"wraps inputs"| node_data
node_execution -->|"ships inputs"| node_data
node_storage -->|"reads and writes"| node_gcs
node_cli -->|"routes command"| node_init
node_cli -->|"routes command"| node_up
node_init -->|"starts creation"| node_up
node_up -->|"provisions via"| node_state
node_state -->|"manages stack"| node_stack
node_stack -->|"runs program"| node_program
node_stack -->|"configures backend"| node_statebackend
node_program -->|"configures hardware"| node_accelerators
node_program -.->|"provisions"| node_cluster
node_program -.->|"provisions"| node_acceleratorservice
node_init -->|"saves context"| node_profiles
node_cli -->|"resolves context"| node_profiles
node_user -->|"runs commands"| node_cli

click node_decorator "https://github.com/keras-team/kinetic/blob/main/kinetic/core/core.py"
click node_execution "https://github.com/keras-team/kinetic/blob/main/kinetic/backend/execution.py"
click node_runner "https://github.com/keras-team/kinetic/blob/main/kinetic/runner/remote_runner.py"
click node_container "https://github.com/keras-team/kinetic/blob/main/kinetic/infra/container_builder.py"
click node_accelerators "https://github.com/keras-team/kinetic/blob/main/kinetic/core/accelerators.py"
click node_gke "https://github.com/keras-team/kinetic/blob/main/kinetic/backend/gke_client.py"
click node_pathways "https://github.com/keras-team/kinetic/blob/main/kinetic/backend/pathways_client.py"
click node_k8s "https://github.com/keras-team/kinetic/blob/main/kinetic/backend/k8s_utils.py"
click node_jobsapi "https://github.com/keras-team/kinetic/blob/main/kinetic/jobs.py"
click node_collections "https://github.com/keras-team/kinetic/blob/main/kinetic/collections.py"
click node_data "https://github.com/keras-team/kinetic/blob/main/kinetic/data/data.py"
click node_storage "https://github.com/keras-team/kinetic/blob/main/kinetic/utils/storage.py"
click node_logs "https://github.com/keras-team/kinetic/blob/main/kinetic/backend/log_streaming.py"
click node_cli "https://github.com/keras-team/kinetic/blob/main/kinetic/cli/main.py"
click node_init "https://github.com/keras-team/kinetic/blob/main/kinetic/cli/commands/init.py"
click node_up "https://github.com/keras-team/kinetic/blob/main/kinetic/cli/commands/up.py"
click node_state "https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/state.py"
click node_stack "https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/stack_manager.py"
click node_program "https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/program.py"
click node_statebackend "https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/state_backend.py"
click node_profiles "https://github.com/keras-team/kinetic/blob/main/kinetic/cli/profiles.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_decorator,node_execution,node_runner,node_container,node_accelerators,node_gke,node_pathways,node_k8s,node_user toneBlue
class node_jobsapi,node_collections,node_data,node_storage,node_logs,node_gcs toneAmber
class node_state,node_stack,node_program,node_statebackend toneMint
class node_cli,node_init,node_up,node_profiles toneRose
class node_cluster,node_acceleratorservice toneIndigo
```

## Components

### Remote execution

- [Run decorator](https://github.com/keras-team/kinetic/blob/main/kinetic/core/core.py): `kinetic/core/core.py`
- [Execution backend](https://github.com/keras-team/kinetic/blob/main/kinetic/backend/execution.py): `kinetic/backend/execution.py`
- [Remote runner](https://github.com/keras-team/kinetic/blob/main/kinetic/runner/remote_runner.py): `kinetic/runner/remote_runner.py`
- [Container builder](https://github.com/keras-team/kinetic/blob/main/kinetic/infra/container_builder.py): `kinetic/infra/container_builder.py`
- [Accelerator registry](https://github.com/keras-team/kinetic/blob/main/kinetic/core/accelerators.py): `kinetic/core/accelerators.py`
- [GKE job client](https://github.com/keras-team/kinetic/blob/main/kinetic/backend/gke_client.py): `kinetic/backend/gke_client.py`
- [Pathways client](https://github.com/keras-team/kinetic/blob/main/kinetic/backend/pathways_client.py): `kinetic/backend/pathways_client.py`
- [Kubernetes utilities](https://github.com/keras-team/kinetic/blob/main/kinetic/backend/k8s_utils.py): `kinetic/backend/k8s_utils.py`

### Jobs and data

- [Job handles](https://github.com/keras-team/kinetic/blob/main/kinetic/jobs.py): `kinetic/jobs.py`
- [Async collections](https://github.com/keras-team/kinetic/blob/main/kinetic/collections.py): `kinetic/collections.py`
- [Data inputs](https://github.com/keras-team/kinetic/blob/main/kinetic/data/data.py): `kinetic/data/data.py`
- [Cloud Storage](https://github.com/keras-team/kinetic/blob/main/kinetic/utils/storage.py): `kinetic/utils/storage.py`
- [Log streaming](https://github.com/keras-team/kinetic/blob/main/kinetic/backend/log_streaming.py): `kinetic/backend/log_streaming.py`

### Infrastructure management

- [Infrastructure state](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/state.py): `kinetic/cli/infra/state.py`
- [Stack manager](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/stack_manager.py): `kinetic/cli/infra/stack_manager.py`
- [Cloud resources](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/program.py): `kinetic/cli/infra/program.py`
- [State backend](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/infra/state_backend.py): `kinetic/cli/infra/state_backend.py`

### CLI configuration

- [CLI entry point](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/main.py): `kinetic/cli/main.py`
- [Cluster setup](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/commands/init.py): `kinetic/cli/commands/init.py`
- [Provision cluster](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/commands/up.py): `kinetic/cli/commands/up.py`
- [Profiles](https://github.com/keras-team/kinetic/blob/main/kinetic/cli/profiles.py): `kinetic/cli/profiles.py`

### Other components

- **User**
- **Google Cloud Storage**
- **GKE cluster**
- **Cloud accelerators**

## Connections

- User → Run decorator: decorates function
- Run decorator → Execution backend: submits work (evidence: `kinetic/core/core.py`)
- Execution backend → Container builder: builds image (evidence: `kinetic/backend/execution.py`)
- Execution backend → Cloud Storage: uploads artifacts (evidence: `kinetic/backend/execution.py`)
- Execution backend → GKE job client: dispatches jobs (evidence: `kinetic/backend/execution.py`)
- Execution backend → Pathways client: dispatches jobs (evidence: `kinetic/backend/execution.py`)
- Execution backend → Accelerator registry: resolves hardware
- GKE job client → Kubernetes utilities: uses utilities (evidence: `kinetic/backend/gke_client.py`)
- Pathways client → Kubernetes utilities: builds pod volumes (evidence: `kinetic/backend/pathways_client.py`)
- GKE job client → Log streaming: streams logs (evidence: `kinetic/backend/gke_client.py`)
- Pathways client → Log streaming: streams logs (evidence: `kinetic/backend/pathways_client.py`)
- Run decorator → Job handles: returns handle (evidence: `kinetic/core/core.py`)
- Job handles → GKE job client: manages jobs (evidence: `kinetic/jobs.py`)
- Job handles → Pathways client: manages jobs (evidence: `kinetic/jobs.py`)
- Job handles → Cloud Storage: collects results (evidence: `kinetic/jobs.py`)
- Async collections → Job handles: tracks children (evidence: `kinetic/collections.py`)
- User → Data inputs: wraps inputs
- Execution backend → Data inputs: ships inputs (evidence: `kinetic/backend/execution.py`)
- Cloud Storage → Google Cloud Storage: reads and writes (evidence: `kinetic/utils/storage.py`)
- CLI entry point → Cluster setup: routes command (evidence: `kinetic/cli/main.py`)
- CLI entry point → Provision cluster: routes command (evidence: `kinetic/cli/main.py`)
- Cluster setup → Provision cluster: starts creation (evidence: `kinetic/cli/commands/init.py`)
- Provision cluster → Infrastructure state: provisions via (evidence: `kinetic/cli/commands/up.py`)
- Infrastructure state → Stack manager: manages stack (evidence: `kinetic/cli/infra/state.py`)
- Stack manager → Cloud resources: runs program (evidence: `kinetic/cli/infra/stack_manager.py`)
- Stack manager → State backend: configures backend (evidence: `kinetic/cli/infra/stack_manager.py`)
- Cloud resources → Accelerator registry: configures hardware (evidence: `kinetic/cli/infra/program.py`)
- Cloud resources → GKE cluster: provisions
- Cloud resources → Cloud accelerators: provisions
- Cluster setup → Profiles: saves context (evidence: `kinetic/cli/commands/init.py`)
- CLI entry point → Profiles: resolves context (evidence: `kinetic/cli/main.py`)
- User → CLI entry point: runs commands
