# vaibhavsarmai05-oss/bugfix-agent architecture

> Architecture diagram of the GitHub repository vaibhavsarmai05-oss/bugfix-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vaibhavsarmai05-oss/bugfix-agent
- Repository: https://github.com/vaibhavsarmai05-oss/bugfix-agent

## Overview

BugFix Agent is a web-based Python debugging tool: a user submits code, the API checks syntax and runs it in an isolated subprocess, then reports an explanation and any supported fix or regression test. A proposed fix can be submitted to the verify endpoint, which runs it through the same executor. The README documents broader error-catalogue and test-generation capabilities; their modules are included, though the generator source was not sampled. Connections below are limited to shown calls or documented behavior.

Main entry points: [`backend/app.py`](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/app.py) (API application), [`frontend/script.js`](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/frontend/script.js) (Web interface), [`backend/runner.py`](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/runner.py) (Isolated runner), [`api/index.py`](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/api/index.py) (API adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_web_ui["Web interface<br/>[script.js]"]
end

subgraph group_api["API workflow"]
  node_api_entry["API application<br/>[app.py]"]
  node_syntax_check["Syntax check<br/>[app.py]"]
  node_api_adapter["API adapter<br/>[index.py]"]
end

subgraph group_analysis["Diagnosis and repair"]
  node_error_catalogue["Error catalogue<br/>[ai_service.py]"]
  node_fix_proposer["Fix proposer<br/>[fixer.py]"]
  node_test_generator["Regression tests<br/>[test_generator.py]"]
end

subgraph group_execution["Code execution"]
  node_code_runner["Isolated runner<br/>[runner.py]"]
  node_child_process(("Python subprocess"))
end

node_user(("Developer"))

node_user -->|"submits code"| node_web_ui
node_web_ui -->|"posts analysis"| node_api_entry
node_web_ui -->|"posts fix"| node_api_entry
node_api_entry -->|"parses code"| node_syntax_check
node_api_entry -->|"runs code"| node_code_runner
node_api_entry -->|"requests diagnosis"| node_error_catalogue
node_api_entry -->|"requests fix"| node_fix_proposer
node_api_entry -->|"requests test"| node_test_generator
node_code_runner -->|"executes code"| node_child_process
node_api_adapter -->|"imports app"| node_api_entry

click node_web_ui "https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/frontend/script.js"
click node_api_entry "https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/app.py"
click node_syntax_check "https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/app.py"
click node_error_catalogue "https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/ai_service.py"
click node_fix_proposer "https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/core/fixer.py"
click node_test_generator "https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/core/test_generator.py"
click node_code_runner "https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/runner.py"
click node_api_adapter "https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/api/index.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_web_ui toneBlue
class node_api_entry,node_syntax_check,node_api_adapter toneAmber
class node_error_catalogue,node_fix_proposer,node_test_generator toneMint
class node_code_runner,node_child_process toneRose
class node_user toneIndigo
```

## Components

### User interface

- [Web interface](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/frontend/script.js): `frontend/script.js`

### API workflow

- [API application](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/app.py): `backend/app.py`
- [Syntax check](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/app.py): `backend/app.py`
- [API adapter](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/api/index.py): `api/index.py`

### Diagnosis and repair

- [Error catalogue](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/ai_service.py): `backend/ai_service.py`
- [Fix proposer](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/core/fixer.py): `core/fixer.py`
- [Regression tests](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/core/test_generator.py): `core/test_generator.py`

### Code execution

- [Isolated runner](https://github.com/vaibhavsarmai05-oss/bugfix-agent/blob/main/backend/runner.py): `backend/runner.py`
- **Python subprocess**

### Other components

- **Developer**

## Connections

- Developer → Web interface: submits code (evidence: `README.md`)
- Web interface → API application: posts analysis (evidence: `frontend/script.js`)
- Web interface → API application: posts fix (evidence: `frontend/script.js`)
- API application → Syntax check: parses code (evidence: `backend/app.py`)
- API application → Isolated runner: runs code (evidence: `backend/app.py`)
- API application → Error catalogue: requests diagnosis (evidence: `backend/app.py`)
- API application → Fix proposer: requests fix (evidence: `backend/app.py`)
- API application → Regression tests: requests test (evidence: `backend/app.py`)
- Isolated runner → Python subprocess: executes code (evidence: `backend/runner.py`)
- API adapter → API application: imports app (evidence: `api/index.py`)
