# thanmai56/ds-agentforge architecture

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

- Interactive diagram: https://gitdiagram.com/thanmai56/ds-agentforge
- Repository: https://github.com/thanmai56/ds-agentforge

## Overview

DS ModelForge is an SAP Datasphere semantic-modeling workbench. Its documented user workflow turns a business requirement and uploaded or pasted schema into a lineage graph, editable model canvas, validated specifications, and downloadable CSN. The README also describes AI-assisted modeling and backend generation, but notes that the current database-free startup mounts only health/root routes and WebSocket transport; stateful REST features are unavailable. The browser-based schema lineage and CSN download path works without those endpoints. Some subsystem details come from README descriptions rather than sampled implementation.

Main entry points: [`frontend/src/utils/dynamicLineageBuilder.ts`](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/utils/dynamicLineageBuilder.ts) (Lineage builder), [`frontend/src/pages/ChatRequirementPage.tsx`](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/pages/ChatRequirementPage.tsx) (Requirement intake), [`frontend/src/utils/schemaCompressor.ts`](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/utils/schemaCompressor.ts) (Schema compressor), [`frontend/src/components/canvas/DatasphereCanvas.tsx`](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/components/canvas/DatasphereCanvas.tsx) (Model canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Requirement and schema"]
  node_requirements["Requirement intake"]
  node_schema_compressor["Schema compressor"]
end

subgraph group_model["Modeling workbench"]
  node_lineage_builder["Lineage builder"]
  node_lineage_view["Lineage views"]
  node_canvas["Model canvas"]
  node_canvas_nodes["Canvas operators<br/>[CustomNodes.tsx]"]
  node_planning["Plan workflow<br/>[PlanningPage.tsx]"]
  node_formula_gate["Formula approval<br/>[FormulaGate.tsx]"]
end

subgraph group_generation["Generation and validation"]
  node_validation["Model validation<br/>[index.ts]"]
  node_topo_exporter["CSN exporter<br/>[topoExporter.ts]"]
  node_export_page["CSN downloads<br/>[ExportPage.tsx]"]
end

subgraph group_backend["Backend services"]
  node_agent["Modeling agent"]
  node_canvas_builder["Canvas synthesis"]
  node_backend_renderer["Native renderer"]
  node_scaffold_renderer["Scaffold renderer<br/>[renderer.py]"]
  node_api_entry["API entry<br/>[main.py]"]
  node_websocket["WebSocket transport<br/>[websocket.py]"]
end

node_user(("Modeler"))

node_user -->|"states requirement"| node_requirements
node_requirements -->|"compresses schema"| node_schema_compressor
node_schema_compressor -->|"supplies metadata"| node_lineage_builder
node_lineage_builder -->|"builds lineage"| node_lineage_view
node_lineage_builder -->|"exports CSN"| node_topo_exporter
node_user -->|"edits model"| node_canvas
node_canvas -->|"renders operators"| node_canvas_nodes
node_user -->|"reviews plan"| node_planning
node_planning -.->|"requests approval"| node_formula_gate
node_user -->|"validates model"| node_validation
node_topo_exporter -->|"provides downloads"| node_export_page
node_agent -.->|"synthesizes canvas"| node_canvas_builder
node_backend_renderer -.->|"uses renderer"| node_scaffold_renderer
node_api_entry -->|"mounts transport"| node_websocket

click node_requirements "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/pages/ChatRequirementPage.tsx"
click node_schema_compressor "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/utils/schemaCompressor.ts"
click node_lineage_builder "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/utils/dynamicLineageBuilder.ts"
click node_lineage_view "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/components/lineage/DatasphereLineageView.tsx"
click node_canvas "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/components/canvas/DatasphereCanvas.tsx"
click node_canvas_nodes "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/components/canvas/CustomNodes.tsx"
click node_planning "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/ui/pages/PlanningPage.tsx"
click node_formula_gate "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/ui/panels/FormulaGate.tsx"
click node_validation "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/core/validate/index.ts"
click node_topo_exporter "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/core/csn/topoExporter.ts"
click node_export_page "https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/pages/ExportPage.tsx"
click node_agent "https://github.com/thanmai56/ds-agentforge/tree/main/backend/app/agent"
click node_canvas_builder "https://github.com/thanmai56/ds-agentforge/blob/main/backend/app/agent/datasphere_canvas_builder.py"
click node_backend_renderer "https://github.com/thanmai56/ds-agentforge/blob/main/backend/app/services/ds_native_renderer.py"
click node_scaffold_renderer "https://github.com/thanmai56/ds-agentforge/blob/main/backend/formatlib/v1_scaffold/renderer.py"
click node_api_entry "https://github.com/thanmai56/ds-agentforge/blob/main/backend/app/main.py"
click node_websocket "https://github.com/thanmai56/ds-agentforge/blob/main/backend/app/api/v1/websocket.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_requirements,node_schema_compressor toneBlue
class node_lineage_builder,node_lineage_view,node_canvas,node_canvas_nodes,node_planning,node_formula_gate toneAmber
class node_validation,node_topo_exporter,node_export_page toneMint
class node_agent,node_canvas_builder,node_backend_renderer,node_scaffold_renderer,node_api_entry,node_websocket toneRose
class node_user toneIndigo
```

## Components

### Requirement and schema

- [Requirement intake](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/pages/ChatRequirementPage.tsx): `frontend/src/pages/ChatRequirementPage.tsx`
- [Schema compressor](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/utils/schemaCompressor.ts): `frontend/src/utils/schemaCompressor.ts`

### Modeling workbench

- [Lineage builder](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/utils/dynamicLineageBuilder.ts): `frontend/src/utils/dynamicLineageBuilder.ts`
- [Lineage views](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/components/lineage/DatasphereLineageView.tsx): `frontend/src/components/lineage/DatasphereLineageView.tsx`
- [Model canvas](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/components/canvas/DatasphereCanvas.tsx): `frontend/src/components/canvas/DatasphereCanvas.tsx`
- [Canvas operators](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/components/canvas/CustomNodes.tsx): `frontend/src/components/canvas/CustomNodes.tsx`
- [Plan workflow](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/ui/pages/PlanningPage.tsx): `frontend/src/ui/pages/PlanningPage.tsx`
- [Formula approval](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/ui/panels/FormulaGate.tsx): `frontend/src/ui/panels/FormulaGate.tsx`

### Generation and validation

- [Model validation](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/core/validate/index.ts): `frontend/src/core/validate/index.ts`
- [CSN exporter](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/core/csn/topoExporter.ts): `frontend/src/core/csn/topoExporter.ts`
- [CSN downloads](https://github.com/thanmai56/ds-agentforge/blob/main/frontend/src/pages/ExportPage.tsx): `frontend/src/pages/ExportPage.tsx`

### Backend services

- [Modeling agent](https://github.com/thanmai56/ds-agentforge/tree/main/backend/app/agent): `backend/app/agent`
- [Canvas synthesis](https://github.com/thanmai56/ds-agentforge/blob/main/backend/app/agent/datasphere_canvas_builder.py): `backend/app/agent/datasphere_canvas_builder.py`
- [Native renderer](https://github.com/thanmai56/ds-agentforge/blob/main/backend/app/services/ds_native_renderer.py): `backend/app/services/ds_native_renderer.py`
- [Scaffold renderer](https://github.com/thanmai56/ds-agentforge/blob/main/backend/formatlib/v1_scaffold/renderer.py): `backend/formatlib/v1_scaffold/renderer.py`
- [API entry](https://github.com/thanmai56/ds-agentforge/blob/main/backend/app/main.py): `backend/app/main.py`
- [WebSocket transport](https://github.com/thanmai56/ds-agentforge/blob/main/backend/app/api/v1/websocket.py): `backend/app/api/v1/websocket.py`

### Other components

- **Modeler**

## Connections

- Modeler → Requirement intake: states requirement (evidence: `README.md`)
- Requirement intake → Schema compressor: compresses schema (evidence: `frontend/src/pages/ChatRequirementPage.tsx`)
- Schema compressor → Lineage builder: supplies metadata (evidence: `frontend/src/utils/dynamicLineageBuilder.ts`)
- Lineage builder → Lineage views: builds lineage (evidence: `README.md`)
- Lineage builder → CSN exporter: exports CSN (evidence: `README.md`)
- Modeler → Model canvas: edits model (evidence: `README.md`)
- Model canvas → Canvas operators: renders operators (evidence: `frontend/src/components/canvas/DatasphereCanvas.tsx`)
- Modeler → Plan workflow: reviews plan (evidence: `README.md`)
- Plan workflow → Formula approval: requests approval
- Modeler → Model validation: validates model (evidence: `README.md`)
- CSN exporter → CSN downloads: provides downloads (evidence: `README.md`)
- Modeling agent → Canvas synthesis: synthesizes canvas
- Native renderer → Scaffold renderer: uses renderer
- API entry → WebSocket transport: mounts transport (evidence: `backend/app/main.py`)
