# adithya-76/soverign-ai-workbench architecture

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

- Interactive diagram: https://gitdiagram.com/adithya-76/soverign-ai-workbench
- Repository: https://github.com/adithya-76/soverign-ai-workbench

## Overview

AEGIS is a local-first industrial AI workbench: users upload reports or ask a task, the backend processes documents, routes inference to local Ollama models, grounds answers in a local SOP index, and exposes agent verification results for review. The graph includes the documented capabilities whose implementation is not visible in the supplied source, but does not invent their wiring. Source excerpts show routing, retrieval, inference, and UI composition; the README supplies the broader workflow. The tree does not show a deliverable builder or network-audit implementation.

Main entry points: [`frontend/src/App.tsx`](https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/App.tsx) (Workbench shell), [`backend/app/api/router.py`](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/router.py) (API router), [`backend/app/agents/engine.py`](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/agents/engine.py) (Agent loop), [`backend/app/api/routes/rag.py`](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/rag.py) (RAG endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Workbench UI"]
  node_workbench["Workbench shell<br/>[App.tsx]"]
  node_document_ui["Document workspace"]
  node_document_viewer["Document viewer<br/>[DocumentViewer.tsx]"]
  node_analysis_ui["AI analysis"]
  node_agent_ui["Agent tasks<br/>[AgentTaskPanel.tsx]"]
  node_sovereignty_ui["Sovereignty status"]
end

subgraph group_api["API and ingestion"]
  node_api_entry["FastAPI entry<br/>[main.py]"]
  node_api_router["API router<br/>[router.py]"]
  node_document_routes["Document endpoints<br/>[documents.py]"]
  node_health_routes["Health endpoint<br/>[health.py]"]
  node_ai_routes["AI endpoints<br/>[ai.py]"]
  node_rag_routes["RAG endpoints<br/>[rag.py]"]
  node_agent_routes["Agent endpoint<br/>[agent.py]"]
  node_processor["Document processing<br/>[processor.py]"]
  node_synthetic["Synthetic reports"]
end

subgraph group_intelligence["Local intelligence"]
  node_classifier["Task classification<br/>[classifier.py]"]
  node_model_router["Model routing<br/>[router.py]"]
  node_ollama["Local inference<br/>[ollama_client.py]"]
  node_rag_index[("SOP index<br/>[core.py]")]
  node_agent_engine["Agent loop<br/>[engine.py]"]
end

subgraph group_platform["Runtime services"]
  node_execution_log[("Execution log")]
  node_tools["Local tools<br/>[registry.py]"]
end

node_operator(("Industrial user"))
node_ollama_service{{"Ollama runtime"}}
node_sop_corpus[("Local SOP corpus")]

node_operator -->|"uses"| node_workbench
node_workbench -->|"renders"| node_document_ui
node_workbench -->|"renders"| node_document_viewer
node_workbench -->|"renders"| node_analysis_ui
node_workbench -->|"renders"| node_agent_ui
node_workbench -->|"renders"| node_sovereignty_ui
node_workbench -->|"fetches health"| node_health_routes
node_workbench -->|"fetches documents"| node_document_routes
node_workbench -.->|"sends requests"| node_api_entry
node_api_entry -->|"mounts"| node_api_router
node_api_router -->|"registers"| node_document_routes
node_api_router -->|"registers"| node_health_routes
node_api_router -->|"registers"| node_ai_routes
node_api_router -->|"registers"| node_rag_routes
node_api_router -->|"registers"| node_agent_routes
node_document_routes -->|"processes uploads"| node_processor
node_document_routes -->|"generates reports"| node_synthetic
node_ai_routes -->|"routes task"| node_model_router
node_model_router -->|"classifies task"| node_classifier
node_ai_routes -->|"requests inference"| node_ollama
node_rag_routes -->|"retrieves evidence"| node_rag_index
node_rag_routes -->|"routes task"| node_model_router
node_rag_routes -->|"requests inference"| node_ollama
node_agent_routes -->|"runs task"| node_agent_engine
node_agent_engine -->|"retrieves evidence"| node_rag_routes
node_agent_engine -->|"routes task"| node_model_router
node_agent_engine -->|"generates answer"| node_ollama
node_agent_engine -->|"logs actions"| node_execution_log
node_agent_engine -.->|"uses tools"| node_tools
node_ollama -->|"calls localhost"| node_ollama_service
node_sop_corpus -->|"indexed locally"| node_rag_index
node_rag_index -->|"indexes corpus"| node_sop_corpus
node_operator -.->|"provides manuals"| node_sop_corpus

click node_workbench "https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/App.tsx"
click node_document_ui "https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/DocumentUploadPanel.tsx"
click node_document_viewer "https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/DocumentViewer.tsx"
click node_analysis_ui "https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/AIAnalysisModal.tsx"
click node_agent_ui "https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/AgentTaskPanel.tsx"
click node_sovereignty_ui "https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/SovereigntyStatus.tsx"
click node_api_entry "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/main.py"
click node_api_router "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/router.py"
click node_document_routes "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/documents.py"
click node_health_routes "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/health.py"
click node_ai_routes "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/ai.py"
click node_rag_routes "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/rag.py"
click node_agent_routes "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/agent.py"
click node_processor "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/documents/processor.py"
click node_synthetic "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/documents/synthetic_generator.py"
click node_classifier "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/routing/classifier.py"
click node_model_router "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/routing/router.py"
click node_ollama "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/services/ollama_client.py"
click node_rag_index "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/rag/core.py"
click node_agent_engine "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/agents/engine.py"
click node_execution_log "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/services/execution_logger.py"
click node_tools "https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/tools/registry.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_workbench,node_document_ui,node_document_viewer,node_analysis_ui,node_agent_ui,node_sovereignty_ui,node_operator toneBlue
class node_api_entry,node_api_router,node_document_routes,node_health_routes,node_ai_routes,node_rag_routes,node_agent_routes,node_processor,node_synthetic,node_sop_corpus toneAmber
class node_classifier,node_model_router,node_ollama,node_rag_index,node_agent_engine toneMint
class node_execution_log,node_tools toneRose
class node_ollama_service toneIndigo
```

## Components

### Workbench UI

- [Workbench shell](https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Document workspace](https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/DocumentUploadPanel.tsx): `frontend/src/components/DocumentUploadPanel.tsx`
- [Document viewer](https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/DocumentViewer.tsx): `frontend/src/components/DocumentViewer.tsx`
- [AI analysis](https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/AIAnalysisModal.tsx): `frontend/src/components/AIAnalysisModal.tsx`
- [Agent tasks](https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/AgentTaskPanel.tsx): `frontend/src/components/AgentTaskPanel.tsx`
- [Sovereignty status](https://github.com/adithya-76/soverign-ai-workbench/blob/main/frontend/src/components/SovereigntyStatus.tsx): `frontend/src/components/SovereigntyStatus.tsx`

### API and ingestion

- [FastAPI entry](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/main.py): `backend/app/main.py`
- [API router](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Document endpoints](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/documents.py): `backend/app/api/routes/documents.py`
- [Health endpoint](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/health.py): `backend/app/api/routes/health.py`
- [AI endpoints](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/ai.py): `backend/app/api/routes/ai.py`
- [RAG endpoints](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/rag.py): `backend/app/api/routes/rag.py`
- [Agent endpoint](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/api/routes/agent.py): `backend/app/api/routes/agent.py`
- [Document processing](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/documents/processor.py): `backend/app/documents/processor.py`
- [Synthetic reports](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/documents/synthetic_generator.py): `backend/app/documents/synthetic_generator.py`

### Local intelligence

- [Task classification](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/routing/classifier.py): `backend/app/routing/classifier.py`
- [Model routing](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/routing/router.py): `backend/app/routing/router.py`
- [Local inference](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/services/ollama_client.py): `backend/app/services/ollama_client.py`
- [SOP index](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/rag/core.py): `backend/app/rag/core.py`
- [Agent loop](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/agents/engine.py): `backend/app/agents/engine.py`

### Runtime services

- [Execution log](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/services/execution_logger.py): `backend/app/services/execution_logger.py`
- [Local tools](https://github.com/adithya-76/soverign-ai-workbench/blob/main/backend/app/tools/registry.py): `backend/app/tools/registry.py`

### Other components

- **Industrial user**
- **Ollama runtime**
- **Local SOP corpus**

## Connections

- Industrial user → Workbench shell: uses
- Workbench shell → Document workspace: renders (evidence: `frontend/src/App.tsx`)
- Workbench shell → Document viewer: renders (evidence: `frontend/src/App.tsx`)
- Workbench shell → AI analysis: renders (evidence: `frontend/src/App.tsx`)
- Workbench shell → Agent tasks: renders (evidence: `frontend/src/App.tsx`)
- Workbench shell → Sovereignty status: renders (evidence: `frontend/src/App.tsx`)
- Workbench shell → Health endpoint: fetches health (evidence: `frontend/src/App.tsx`)
- Workbench shell → Document endpoints: fetches documents (evidence: `frontend/src/App.tsx`)
- Workbench shell → FastAPI entry: sends requests
- FastAPI entry → API router: mounts (evidence: `backend/app/main.py`)
- API router → Document endpoints: registers (evidence: `backend/app/api/router.py`)
- API router → Health endpoint: registers (evidence: `backend/app/api/router.py`)
- API router → AI endpoints: registers (evidence: `backend/app/api/router.py`)
- API router → RAG endpoints: registers (evidence: `backend/app/api/router.py`)
- API router → Agent endpoint: registers (evidence: `backend/app/api/router.py`)
- Document endpoints → Document processing: processes uploads (evidence: `backend/app/api/routes/documents.py`)
- Document endpoints → Synthetic reports: generates reports (evidence: `backend/app/api/routes/documents.py`)
- AI endpoints → Model routing: routes task (evidence: `backend/app/api/routes/ai.py`)
- Model routing → Task classification: classifies task (evidence: `backend/app/routing/router.py`)
- AI endpoints → Local inference: requests inference (evidence: `backend/app/api/routes/ai.py`)
- RAG endpoints → SOP index: retrieves evidence (evidence: `backend/app/api/routes/rag.py`)
- RAG endpoints → Model routing: routes task (evidence: `backend/app/api/routes/rag.py`)
- RAG endpoints → Local inference: requests inference (evidence: `backend/app/api/routes/rag.py`)
- Agent endpoint → Agent loop: runs task (evidence: `backend/app/api/routes/agent.py`)
- Agent loop → RAG endpoints: retrieves evidence (evidence: `backend/app/agents/engine.py`)
- Agent loop → Model routing: routes task (evidence: `backend/app/agents/engine.py`)
- Agent loop → Local inference: generates answer (evidence: `backend/app/agents/engine.py`)
- Agent loop → Execution log: logs actions (evidence: `backend/app/agents/engine.py`)
- Agent loop → Local tools: uses tools (evidence: `backend/app/agents/engine.py`)
- Local inference → Ollama runtime: calls localhost (evidence: `backend/app/services/ollama_client.py`)
- Local SOP corpus → SOP index: indexed locally
- SOP index → Local SOP corpus: indexes corpus
- Industrial user → Local SOP corpus: provides manuals
