# prasanth866/learning_sandbox architecture

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

- Interactive diagram: https://gitdiagram.com/prasanth866/learning_sandbox
- Repository: https://github.com/prasanth866/learning_sandbox

## Overview

This repository is a sandbox of three independent prototypes, not one end-to-end product. The async backend accepts task commands over WebSockets, queues and runs them, then streams lifecycle and output events; the Bayesian project builds student-performance networks and compares exact and approximate inference. The LangChain directory documents an ecosystem exploration, but its implementation is not present in the sampled source. Edges reflect shown calls or README claims; unsampled subsystems are included without inferred wiring.

Main entry points: [`01-async-flow/main.py`](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/main.py) (WebSocket API), [`01-async-flow/manager.py`](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/manager.py) (Connection manager), [`01-async-flow/worker.py`](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/worker.py) (Worker pool and reaper), [`03-student-performance-bayes/network.py`](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/network.py) (Bayesian network model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_async["Async command backend"]
  node_api["WebSocket API<br/>[main.py]"]
  node_messages["Task and client state<br/>[models.py]"]
  node_connections["Connection manager<br/>[manager.py]"]
  node_jobqueue["Job queue<br/>[worker.py]"]
  node_pool["Worker pool and reaper<br/>[worker.py]"]
  node_runner["Streaming command runner<br/>[runner.py]"]
  node_process["Command process"]
end

subgraph group_langchain["LangChain exploration"]
  node_langchaincap["LCEL, vector stores, agents, observability"]
end

subgraph group_bayes["Bayesian inference"]
  node_data["Data acquisition<br/>[download_data.py]"]
  node_network["Bayesian network model<br/>[network.py]"]
  node_factor["Probability factors<br/>[factor.py]"]
  node_synthetic["Network construction and sampling<br/>[synthetic.py]"]
  node_exact["Exact inference<br/>[exact.py]"]
  node_sampling["Approximate inference<br/>[sampling.py]"]
  node_evaluation["Inference comparison<br/>[compare.py]"]
  node_plots["Plotting<br/>[plots.py]"]
end

node_client(("WebSocket client"))

node_client -->|"sends commands"| node_api
node_api -->|"connects and sends"| node_connections
node_api -->|"validates messages"| node_messages
node_api -->|"enqueues tasks"| node_jobqueue
node_api -->|"starts workers"| node_pool
node_api -->|"disconnects clients"| node_connections
node_connections -->|"creates client state"| node_messages
node_pool -->|"consumes tasks"| node_jobqueue
node_pool -->|"checks client state"| node_connections
node_pool -->|"runs task"| node_runner
node_runner -->|"emits events"| node_connections
node_runner -->|"launches and streams"| node_process
node_client -.->|"explores capabilities"| node_langchaincap
node_synthetic -->|"constructs networks"| node_network
node_network -->|"stores CPT factors"| node_factor
node_exact -->|"queries network"| node_network
node_exact -->|"reduces and combines"| node_factor
node_sampling -->|"samples network"| node_network
node_evaluation -->|"builds test networks"| node_synthetic
node_evaluation -->|"computes benchmarks"| node_exact
node_evaluation -->|"compares estimates"| node_sampling

click node_api "https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/main.py"
click node_messages "https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/models.py"
click node_connections "https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/manager.py"
click node_jobqueue "https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/worker.py"
click node_pool "https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/worker.py"
click node_runner "https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/runner.py"
click node_langchaincap "https://github.com/prasanth866/learning_sandbox/tree/main/02-langchain-ecosystem"
click node_data "https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/download_data.py"
click node_network "https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/network.py"
click node_factor "https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/factor.py"
click node_synthetic "https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/synthetic.py"
click node_exact "https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/exact.py"
click node_sampling "https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/sampling.py"
click node_evaluation "https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/compare.py"
click node_plots "https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/plots.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_api,node_messages,node_connections,node_jobqueue,node_pool,node_runner,node_process,node_client toneBlue
class node_langchaincap toneAmber
class node_data,node_network,node_factor,node_synthetic,node_exact,node_sampling,node_evaluation,node_plots toneMint
```

## Components

### Async command backend

- [WebSocket API](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/main.py): `01-async-flow/main.py`
- [Task and client state](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/models.py): `01-async-flow/models.py`
- [Connection manager](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/manager.py): `01-async-flow/manager.py`
- [Job queue](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/worker.py): `01-async-flow/worker.py`
- [Worker pool and reaper](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/worker.py): `01-async-flow/worker.py`
- [Streaming command runner](https://github.com/prasanth866/learning_sandbox/blob/main/01-async-flow/runner.py): `01-async-flow/runner.py`
- **Command process**

### LangChain exploration

- [LCEL, vector stores, agents, observability](https://github.com/prasanth866/learning_sandbox/tree/main/02-langchain-ecosystem): `02-langchain-ecosystem`

### Bayesian inference

- [Data acquisition](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/download_data.py): `03-student-performance-bayes/download_data.py`
- [Bayesian network model](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/network.py): `03-student-performance-bayes/network.py`
- [Probability factors](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/factor.py): `03-student-performance-bayes/factor.py`
- [Network construction and sampling](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/synthetic.py): `03-student-performance-bayes/synthetic.py`
- [Exact inference](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/exact.py): `03-student-performance-bayes/exact.py`
- [Approximate inference](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/sampling.py): `03-student-performance-bayes/sampling.py`
- [Inference comparison](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/compare.py): `03-student-performance-bayes/compare.py`
- [Plotting](https://github.com/prasanth866/learning_sandbox/blob/main/03-student-performance-bayes/plots.py): `03-student-performance-bayes/plots.py`

### Other components

- **WebSocket client**

## Connections

- WebSocket client → WebSocket API: sends commands (evidence: `01-async-flow/main.py`)
- WebSocket API → Connection manager: connects and sends (evidence: `01-async-flow/main.py`)
- WebSocket API → Task and client state: validates messages (evidence: `01-async-flow/main.py`)
- WebSocket API → Job queue: enqueues tasks (evidence: `01-async-flow/main.py`)
- WebSocket API → Worker pool and reaper: starts workers (evidence: `01-async-flow/main.py`)
- WebSocket API → Connection manager: disconnects clients (evidence: `01-async-flow/main.py`)
- Connection manager → Task and client state: creates client state (evidence: `01-async-flow/manager.py`)
- Worker pool and reaper → Job queue: consumes tasks (evidence: `01-async-flow/worker.py`)
- Worker pool and reaper → Connection manager: checks client state (evidence: `01-async-flow/worker.py`)
- Worker pool and reaper → Streaming command runner: runs task (evidence: `01-async-flow/worker.py`)
- Streaming command runner → Connection manager: emits events (evidence: `01-async-flow/runner.py`)
- Streaming command runner → Command process: launches and streams (evidence: `01-async-flow/runner.py`)
- WebSocket client → LCEL, vector stores, agents, observability: explores capabilities (evidence: `README.md`)
- Network construction and sampling → Bayesian network model: constructs networks (evidence: `03-student-performance-bayes/synthetic.py`)
- Bayesian network model → Probability factors: stores CPT factors (evidence: `03-student-performance-bayes/network.py`)
- Exact inference → Bayesian network model: queries network (evidence: `03-student-performance-bayes/exact.py`)
- Exact inference → Probability factors: reduces and combines (evidence: `03-student-performance-bayes/exact.py`)
- Approximate inference → Bayesian network model: samples network (evidence: `03-student-performance-bayes/sampling.py`)
- Inference comparison → Network construction and sampling: builds test networks (evidence: `03-student-performance-bayes/compare.py`)
- Inference comparison → Exact inference: computes benchmarks (evidence: `03-student-performance-bayes/compare.py`)
- Inference comparison → Approximate inference: compares estimates (evidence: `03-student-performance-bayes/compare.py`)
