# robertevanstech/human-in-the-loop-ai-demo architecture

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

- Interactive diagram: https://gitdiagram.com/robertevanstech/human-in-the-loop-ai-demo
- Repository: https://github.com/robertevanstech/human-in-the-loop-ai-demo

## Overview

This is a small, dependency-free JavaScript demo of human-in-the-loop decision-making. Its workflow feeds sample messages into a rule-based classifier, which returns one of four structured outcomes; the script prints each result. The README also describes broader production patterns such as human review, context preservation, and returning work to the AI, but those are design goals rather than implemented subsystems in this repository.

Main entry points: [`decision_demo.js`](https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js) (Action classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Message source"))
node_runner["Sample runner<br/>[decision_demo.js]"]
node_decision["Action classifier<br/>[decision_demo.js]"]
node_respond["AI responds<br/>[decision_demo.js]"]
node_clarify["Clarification needed<br/>[decision_demo.js]"]
node_approval["Human approval<br/>[decision_demo.js]"]
node_handoff["Human handoff<br/>[decision_demo.js]"]
node_console["Console output"]

node_user -->|"supplies examples"| node_runner
node_runner -->|"calls classifier"| node_decision
node_decision -->|"returns outcome"| node_respond
node_decision -->|"returns outcome"| node_clarify
node_decision -->|"returns outcome"| node_approval
node_decision -->|"returns outcome"| node_handoff
node_runner -->|"prints result"| node_console

click node_runner "https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js"
click node_decision "https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js"
click node_respond "https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js"
click node_clarify "https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js"
click node_approval "https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js"
click node_handoff "https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js"

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_user,node_console toneIndigo
class node_runner,node_decision,node_respond,node_clarify,node_approval,node_handoff toneTeal
```

## Components

### Other components

- **Message source**
- [Sample runner](https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js): `decision_demo.js`
- [Action classifier](https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js): `decision_demo.js`
- [AI responds](https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js): `decision_demo.js`
- [Clarification needed](https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js): `decision_demo.js`
- [Human approval](https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js): `decision_demo.js`
- [Human handoff](https://github.com/robertevanstech/human-in-the-loop-ai-demo/blob/main/decision_demo.js): `decision_demo.js`
- **Console output**

## Connections

- Message source → Sample runner: supplies examples (evidence: `decision_demo.js`)
- Sample runner → Action classifier: calls classifier (evidence: `decision_demo.js`)
- Action classifier → AI responds: returns outcome (evidence: `decision_demo.js`)
- Action classifier → Clarification needed: returns outcome (evidence: `decision_demo.js`)
- Action classifier → Human approval: returns outcome (evidence: `decision_demo.js`)
- Action classifier → Human handoff: returns outcome (evidence: `decision_demo.js`)
- Sample runner → Console output: prints result (evidence: `decision_demo.js`)
