# aravind-hub/screenshot2codeagent architecture

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

- Interactive diagram: https://gitdiagram.com/aravind-hub/screenshot2codeagent
- Repository: https://github.com/aravind-hub/screenshot2codeagent

## Overview

Screenshot2CodeAgent is an ADK pipeline that turns a screenshot-bearing user request into a clean React/Tailwind component. The root agent orchestrates screenshot analysis, prompt construction, code drafting, and output cleanup. The README states the product goal; the detailed stages and their ordering come from the root agent instructions in agent.py. The repository is small, so this graph focuses on its runtime pipeline rather than delivery infrastructure.

Main entry points: [`my_agent/agent.py`](https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py) (Root orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Agent pipeline"]
  node_root{{"Root orchestrator<br/>[agent.py]"}}
  node_analyst["UI/UX analyst<br/>[agent.py]"]
  node_generator["TSX code generator<br/>[agent.py]"]
end

subgraph group_support["Prompt and cleanup"]
  node_prompt["Prompt builder<br/>[agent.py]"]
  node_cleaner["Code cleaner<br/>[agent.py]"]
end

node_user(("User with screenshot"))
node_gemini{{"Gemini model service"}}
node_result["Clean TSX output"]

node_user -->|"submits request"| node_root
node_root -->|"calls analyst"| node_analyst
node_analyst -->|"provides description"| node_prompt
node_root -->|"builds prompt"| node_prompt
node_root -->|"requests draft"| node_generator
node_root -->|"cleans draft"| node_cleaner
node_cleaner -->|"returns clean code"| node_result
node_analyst -->|"analyzes screenshot"| node_gemini
node_generator -->|"generates TSX"| node_gemini
node_root -->|"uses model"| node_gemini

click node_root "https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py"
click node_analyst "https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py"
click node_prompt "https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py"
click node_generator "https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py"
click node_cleaner "https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.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_root,node_analyst,node_generator,node_user toneBlue
class node_prompt,node_cleaner toneAmber
class node_gemini,node_result toneIndigo
```

## Components

### Agent pipeline

- [Root orchestrator](https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py): `my_agent/agent.py`
- [UI/UX analyst](https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py): `my_agent/agent.py`
- [TSX code generator](https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py): `my_agent/agent.py`

### Prompt and cleanup

- [Prompt builder](https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py): `my_agent/agent.py`
- [Code cleaner](https://github.com/aravind-hub/screenshot2codeagent/blob/main/my_agent/agent.py): `my_agent/agent.py`

### Other components

- **User with screenshot**
- **Gemini model service**
- **Clean TSX output**

## Connections

- User with screenshot → Root orchestrator: submits request (evidence: `my_agent/agent.py`)
- Root orchestrator → UI/UX analyst: calls analyst (evidence: `my_agent/agent.py`)
- UI/UX analyst → Prompt builder: provides description (evidence: `my_agent/agent.py`)
- Root orchestrator → Prompt builder: builds prompt (evidence: `my_agent/agent.py`)
- Root orchestrator → TSX code generator: requests draft (evidence: `my_agent/agent.py`)
- Root orchestrator → Code cleaner: cleans draft (evidence: `my_agent/agent.py`)
- Code cleaner → Clean TSX output: returns clean code (evidence: `my_agent/agent.py`)
- UI/UX analyst → Gemini model service: analyzes screenshot (evidence: `my_agent/agent.py`)
- TSX code generator → Gemini model service: generates TSX (evidence: `my_agent/agent.py`)
- Root orchestrator → Gemini model service: uses model (evidence: `my_agent/agent.py`)
