# spark1805/meta-pytorch-hackathon architecture

> Architecture diagram of the GitHub repository spark1805/meta-pytorch-hackathon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spark1805/meta-pytorch-hackathon
- Repository: https://github.com/spark1805/meta-pytorch-hackathon

## Overview

This is a demonstration RL environment for classifying sample emails, with agent-facing FastAPI endpoints and a Gradio experimentation dashboard. The workflow is: reset to sample an email, inspect its state, submit a label/action, and receive a reward; users can also request grading or compare a baseline. Source confirms both interfaces call the environment directly. The README documents deployment and capabilities; sampled code does not show a separate persistent store or external service integration.

Main entry points: [`api/main.py`](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py) (FastAPI endpoints), [`app/env.py`](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/env.py) (Email environment), [`app.py`](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app.py) (Gradio dashboard), [`app/models.py`](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/models.py) (Action and results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Interaction surfaces"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_dashboard["Gradio dashboard<br/>[app.py]"]
  node_launcher["Server launcher<br/>[app.py]"]
end

subgraph group_environment["RL environment"]
  node_environment["Email environment<br/>[env.py]"]
  node_emails["Email examples<br/>[data.py]"]
end

subgraph group_domain["Task and scoring"]
  node_schemas["Action and results<br/>[models.py]"]
  node_task_catalog["Task catalog<br/>[main.py]"]
  node_grading["Action grader<br/>[main.py]"]
  node_baseline["Baseline scorer<br/>[main.py]"]
  node_task_scores["Task score rules<br/>[tasks.py]"]
end

node_agent(("RL agent"))
node_experimenter(("Dashboard user"))

node_agent -->|"requests"| node_api
node_experimenter -->|"interacts"| node_dashboard
node_launcher -->|"runs"| node_api
node_api -->|"resets, steps, reads state"| node_environment
node_dashboard -->|"resets, steps, reads state"| node_environment
node_environment -->|"samples"| node_emails
node_api -->|"uses"| node_schemas
node_dashboard -->|"constructs actions"| node_schemas
node_api -->|"serves"| node_task_catalog
node_api -->|"grades"| node_grading
node_grading -->|"reads state"| node_environment
node_dashboard -->|"reads state for grading"| node_environment
node_api -->|"computes"| node_baseline
node_baseline -->|"resets and steps"| node_environment

click node_api "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py"
click node_dashboard "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app.py"
click node_launcher "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/server/app.py"
click node_environment "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/env.py"
click node_emails "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/data.py"
click node_schemas "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/models.py"
click node_task_catalog "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py"
click node_grading "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py"
click node_baseline "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py"
click node_task_scores "https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/tasks.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_dashboard,node_launcher,node_experimenter toneBlue
class node_environment,node_emails toneAmber
class node_schemas,node_task_catalog,node_grading,node_baseline,node_task_scores toneMint
class node_agent toneIndigo
```

## Components

### Interaction surfaces

- [FastAPI endpoints](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py): `api/main.py`
- [Gradio dashboard](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app.py): `app.py`
- [Server launcher](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/server/app.py): `server/app.py`

### RL environment

- [Email environment](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/env.py): `app/env.py`
- [Email examples](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/data.py): `app/data.py`

### Task and scoring

- [Action and results](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/models.py): `app/models.py`
- [Task catalog](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py): `api/main.py`
- [Action grader](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py): `api/main.py`
- [Baseline scorer](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/api/main.py): `api/main.py`
- [Task score rules](https://github.com/spark1805/meta-pytorch-hackathon/blob/main/app/tasks.py): `app/tasks.py`

### Other components

- **RL agent**
- **Dashboard user**

## Connections

- RL agent → FastAPI endpoints: requests
- Dashboard user → Gradio dashboard: interacts
- Server launcher → FastAPI endpoints: runs
- FastAPI endpoints → Email environment: resets, steps, reads state
- Gradio dashboard → Email environment: resets, steps, reads state
- Email environment → Email examples: samples
- FastAPI endpoints → Action and results: uses
- Gradio dashboard → Action and results: constructs actions
- FastAPI endpoints → Task catalog: serves
- FastAPI endpoints → Action grader: grades
- Action grader → Email environment: reads state
- Gradio dashboard → Email environment: reads state for grading
- FastAPI endpoints → Baseline scorer: computes
- Baseline scorer → Email environment: resets and steps
