# ali-hey-0/ai-runtime-lab architecture

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

- Interactive diagram: https://gitdiagram.com/ali-hey-0/ai-runtime-lab
- Repository: https://github.com/ali-hey-0/ai-runtime-lab

## Overview

AI Runtime Lab is an educational curriculum and collection of small, independently runnable reference implementations—not an integrated agent framework. The main user journey is to follow the documented phase sequence and study or run each proof of concept to learn a systems concern. The graph preserves the README’s major capability areas, including those whose source was not sampled. The README documents the curriculum and concepts; unsampled implementations are represented by their exact tree paths, without inferred runtime connections between demos.

Main entry points: [`README.md`](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/README.md) (Lab Curriculum), [`fsm/fsm.py`](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/fsm/fsm.py) (Persistent FSM), [`durable_execution/durable_execution.py`](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/durable_execution/durable_execution.py) (Durable Activities), [`Failure-Retry-Idempotency/Failure-Retry-Idempotency.py`](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Failure-Retry-Idempotency/Failure-Retry-Idempotency.py) (Retry & Idempotency)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reliability["Reliability &amp; State"]
  node_fsm["Persistent FSM<br/>[fsm.py]"]
  node_durable["Durable Activities"]
  node_retry["Retry &amp; Idempotency"]
end

subgraph group_execution["Workflow Execution"]
  node_dag["DAG Executor<br/>[dag.py]"]
  node_runtime["Agent Runtime<br/>[agent-runtime.py]"]
end

subgraph group_models["Models &amp; Context"]
  node_routing["Model Routing<br/>[model-routing.py]"]
  node_inference["KV Cache Inference"]
  node_rag["RAG Context"]
  node_memory["Memory Systems<br/>[Memory-Systems.py]"]
end

subgraph group_orchestration["Agent Orchestration"]
  node_swarm["Multi-Agent Handoffs"]
end

subgraph group_assurance["Safety &amp; Observability"]
  node_security["AST Safety Checks"]
  node_eval_v1["Trace &amp; Eval Engine"]
  node_eval_v2["Tracing &amp; Evaluation"]
end

node_learner(("Engineer"))
node_curriculum["Lab Curriculum<br/>[README.md]"]

node_learner -->|"follows phases"| node_curriculum
node_curriculum -->|"introduces state"| node_fsm
node_curriculum -->|"introduces recovery"| node_durable
node_curriculum -->|"introduces retries"| node_retry
node_curriculum -->|"introduces parallelism"| node_dag
node_curriculum -->|"introduces runtime"| node_runtime
node_curriculum -->|"introduces routing"| node_routing
node_curriculum -->|"introduces inference"| node_inference
node_curriculum -->|"introduces retrieval"| node_rag
node_curriculum -->|"introduces memory"| node_memory
node_curriculum -->|"introduces orchestration"| node_swarm
node_curriculum -->|"introduces safety"| node_security
node_curriculum -->|"introduces evaluation"| node_eval_v1
node_curriculum -->|"introduces tracing"| node_eval_v2

click node_curriculum "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/README.md"
click node_fsm "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/fsm/fsm.py"
click node_durable "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/durable_execution/durable_execution.py"
click node_retry "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Failure-Retry-Idempotency/Failure-Retry-Idempotency.py"
click node_dag "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/dag/dag.py"
click node_runtime "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/agent-runtime/agent-runtime.py"
click node_routing "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/model-routing/model-routing.py"
click node_inference "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Inference-KV-Cache/Inference-KV-Cache.py"
click node_rag "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/RAG-Context-Management/RAG-Context-Management.py"
click node_memory "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Memory-Systems/Memory-Systems.py"
click node_swarm "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Multi-Agent-Router-Handoff-Engine/Multi-Agent-Router-Handoff-Engine.py"
click node_security "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Security-Sandboxing-Safety/Security-Sandboxing-Safety.py"
click node_eval_v1 "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Observability-Eval-Engine/Observability-Eval-Engine.py"
click node_eval_v2 "https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Observability-Tracing-Evaluation/Observability-Tracing-Evaluation.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_fsm,node_durable,node_retry toneBlue
class node_dag,node_runtime toneAmber
class node_routing,node_inference,node_rag,node_memory toneMint
class node_swarm toneRose
class node_security,node_eval_v1,node_eval_v2,node_learner toneIndigo
class node_curriculum toneTeal
```

## Components

### Reliability & State

- [Persistent FSM](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/fsm/fsm.py): `fsm/fsm.py`
- [Durable Activities](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/durable_execution/durable_execution.py): `durable_execution/durable_execution.py`
- [Retry & Idempotency](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Failure-Retry-Idempotency/Failure-Retry-Idempotency.py): `Failure-Retry-Idempotency/Failure-Retry-Idempotency.py`

### Workflow Execution

- [DAG Executor](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/dag/dag.py): `dag/dag.py`
- [Agent Runtime](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/agent-runtime/agent-runtime.py): `agent-runtime/agent-runtime.py`

### Models & Context

- [Model Routing](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/model-routing/model-routing.py): `model-routing/model-routing.py`
- [KV Cache Inference](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Inference-KV-Cache/Inference-KV-Cache.py): `Inference-KV-Cache/Inference-KV-Cache.py`
- [RAG Context](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/RAG-Context-Management/RAG-Context-Management.py): `RAG-Context-Management/RAG-Context-Management.py`
- [Memory Systems](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Memory-Systems/Memory-Systems.py): `Memory-Systems/Memory-Systems.py`

### Agent Orchestration

- [Multi-Agent Handoffs](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Multi-Agent-Router-Handoff-Engine/Multi-Agent-Router-Handoff-Engine.py): `Multi-Agent-Router-Handoff-Engine/Multi-Agent-Router-Handoff-Engine.py`

### Safety & Observability

- [AST Safety Checks](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Security-Sandboxing-Safety/Security-Sandboxing-Safety.py): `Security-Sandboxing-Safety/Security-Sandboxing-Safety.py`
- [Trace & Eval Engine](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Observability-Eval-Engine/Observability-Eval-Engine.py): `Observability-Eval-Engine/Observability-Eval-Engine.py`
- [Tracing & Evaluation](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/Observability-Tracing-Evaluation/Observability-Tracing-Evaluation.py): `Observability-Tracing-Evaluation/Observability-Tracing-Evaluation.py`

### Other components

- **Engineer**
- [Lab Curriculum](https://github.com/ali-hey-0/ai-runtime-lab/blob/main/README.md): `README.md`

## Connections

- Engineer → Lab Curriculum: follows phases (evidence: `README.md`)
- Lab Curriculum → Persistent FSM: introduces state (evidence: `README.md`)
- Lab Curriculum → Durable Activities: introduces recovery (evidence: `README.md`)
- Lab Curriculum → Retry & Idempotency: introduces retries (evidence: `README.md`)
- Lab Curriculum → DAG Executor: introduces parallelism (evidence: `README.md`)
- Lab Curriculum → Agent Runtime: introduces runtime (evidence: `README.md`)
- Lab Curriculum → Model Routing: introduces routing (evidence: `README.md`)
- Lab Curriculum → KV Cache Inference: introduces inference (evidence: `README.md`)
- Lab Curriculum → RAG Context: introduces retrieval (evidence: `README.md`)
- Lab Curriculum → Memory Systems: introduces memory (evidence: `README.md`)
- Lab Curriculum → Multi-Agent Handoffs: introduces orchestration (evidence: `README.md`)
- Lab Curriculum → AST Safety Checks: introduces safety (evidence: `README.md`)
- Lab Curriculum → Trace & Eval Engine: introduces evaluation (evidence: `README.md`)
- Lab Curriculum → Tracing & Evaluation: introduces tracing (evidence: `README.md`)
