# suyash-sahu/enterpise-ai-workspace architecture

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

- Interactive diagram: https://gitdiagram.com/suyash-sahu/enterpise-ai-workspace
- Repository: https://github.com/suyash-sahu/enterpise-ai-workspace

## Overview

AMOF is an enterprise AI workspace whose central workflow turns a user request into a persisted plan, routes and dispatches specialized work under privacy and approval controls, then verifies and synthesizes a result. Its major product branches include document retrieval, safe database querying, Google integrations, work management, background automation, and evaluation. The graph uses README-documented relationships for unsampled orchestration and feature areas; it does not claim those source files were inspected.

Main entry points: [`backend/core-platform-service/app/supervisor`](https://github.com/suyash-sahu/enterpise-ai-workspace/tree/main/backend/core-platform-service/app/supervisor) (Supervisor loop), [`backend/core-platform-service/app/execution/executor.py`](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/execution/executor.py) (Task execution), [`backend/core-platform-service/app/rag/pipeline.py`](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/rag/pipeline.py) (Document RAG), [`backend/core-platform-service/app/services/work_ai/pipeline.py`](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/work_ai/pipeline.py) (Work AI proposals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace experience"]
  node_web["Workspace UI<br/>[page.tsx]"]
  node_api["API router<br/>[router.py]"]
end

subgraph group_orchestration["AMOF orchestration"]
  node_supervisor["Supervisor loop"]
  node_planner["Task decomposition<br/>[decomposer.py]"]
  node_privacy["Privacy routing<br/>[router.py]"]
  node_registry["Capability registry<br/>[registry.py]"]
  node_approval["Human approval"]
  node_executor["Task execution<br/>[executor.py]"]
  node_verifier["Verification and replanning<br/>[verifier.py]"]
end

subgraph group_capabilities["AI capabilities"]
  node_rag["Document RAG<br/>[pipeline.py]"]
  node_dbagent["Database agent<br/>[database_agent.py]"]
  node_sqlquery["Safe SQL execution"]
  node_workai["Work AI proposals<br/>[pipeline.py]"]
  node_workgraph["Projects and tasks"]
  node_eval["Evaluation harness"]
end

subgraph group_integrations["Connected services"]
  node_google["Google connectors"]
  node_workers["Background automation<br/>[tasks.py]"]
end

subgraph group_platform["Platform services"]
  node_database[("PostgreSQL and pgvector<br/>[database.py]")]
  node_events["Lifecycle event bus<br/>[publisher.py]"]
end

node_user(("Workspace user"))

node_user -->|"submits request"| node_web
node_web -.->|"sends request"| node_api
node_api -.->|"routes request"| node_supervisor
node_supervisor -->|"decomposes request"| node_planner
node_supervisor -->|"routes by sensitivity"| node_privacy
node_supervisor -->|"dispatches capabilities"| node_registry
node_supervisor -->|"verifies and replans"| node_verifier
node_executor -->|"claims approval"| node_approval
node_registry -.->|"executes capability"| node_executor
node_executor -.->|"runs retrieval task"| node_rag
node_executor -.->|"runs query task"| node_dbagent
node_dbagent -->|"executes validated SQL"| node_sqlquery
node_sqlquery -->|"reads safely"| node_database
node_rag -->|"fetches Drive content"| node_google
node_rag -->|"stores document chunks"| node_database
node_workai -->|"creates approval"| node_approval
node_workai -->|"validates work items"| node_workgraph
node_workai -->|"dispatches approved work"| node_executor
node_workers -->|"ingests Drive files"| node_rag
node_workers -->|"syncs Drive files"| node_google
node_approval -->|"publishes lifecycle events"| node_events
node_user -.->|"connects Google account"| node_google
node_user -->|"runs comparisons"| node_eval

click node_web "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/web/src/app/(workspace)/chat/page.tsx"
click node_api "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/api/router.py"
click node_supervisor "https://github.com/suyash-sahu/enterpise-ai-workspace/tree/main/backend/core-platform-service/app/supervisor"
click node_planner "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/supervisor/decomposer.py"
click node_privacy "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/privacy/router.py"
click node_registry "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/execution/registry.py"
click node_approval "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/approval/approval_service.py"
click node_executor "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/execution/executor.py"
click node_verifier "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/supervisor/verifier.py"
click node_rag "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/rag/pipeline.py"
click node_dbagent "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/agents/database_agent.py"
click node_sqlquery "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/database_query_service.py"
click node_workai "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/work_ai/pipeline.py"
click node_workgraph "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/workgraph_service.py"
click node_google "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/google_connector_service.py"
click node_workers "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/workers/tasks.py"
click node_eval "https://github.com/suyash-sahu/enterpise-ai-workspace/tree/main/backend/core-platform-service/app/evaluation"
click node_database "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/db/database.py"
click node_events "https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/events/publisher.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,node_api,node_user toneBlue
class node_supervisor,node_planner,node_privacy,node_registry,node_approval,node_executor,node_verifier toneAmber
class node_rag,node_dbagent,node_sqlquery,node_workai,node_workgraph,node_eval toneMint
class node_google,node_workers toneRose
class node_database,node_events toneIndigo
```

## Components

### Workspace experience

- [Workspace UI](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/web/src/app/(workspace)/chat/page.tsx): `web/src/app/(workspace)/chat/page.tsx`
- [API router](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/api/router.py): `backend/core-platform-service/app/api/router.py`

### AMOF orchestration

- [Supervisor loop](https://github.com/suyash-sahu/enterpise-ai-workspace/tree/main/backend/core-platform-service/app/supervisor): `backend/core-platform-service/app/supervisor`
- [Task decomposition](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/supervisor/decomposer.py): `backend/core-platform-service/app/supervisor/decomposer.py`
- [Privacy routing](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/privacy/router.py): `backend/core-platform-service/app/privacy/router.py`
- [Capability registry](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/execution/registry.py): `backend/core-platform-service/app/execution/registry.py`
- [Human approval](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/approval/approval_service.py): `backend/core-platform-service/app/services/approval/approval_service.py`
- [Task execution](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/execution/executor.py): `backend/core-platform-service/app/execution/executor.py`
- [Verification and replanning](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/supervisor/verifier.py): `backend/core-platform-service/app/supervisor/verifier.py`

### AI capabilities

- [Document RAG](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/rag/pipeline.py): `backend/core-platform-service/app/rag/pipeline.py`
- [Database agent](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/agents/database_agent.py): `backend/core-platform-service/app/agents/database_agent.py`
- [Safe SQL execution](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/database_query_service.py): `backend/core-platform-service/app/services/database_query_service.py`
- [Work AI proposals](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/work_ai/pipeline.py): `backend/core-platform-service/app/services/work_ai/pipeline.py`
- [Projects and tasks](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/workgraph_service.py): `backend/core-platform-service/app/services/workgraph_service.py`
- [Evaluation harness](https://github.com/suyash-sahu/enterpise-ai-workspace/tree/main/backend/core-platform-service/app/evaluation): `backend/core-platform-service/app/evaluation`

### Connected services

- [Google connectors](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/services/google_connector_service.py): `backend/core-platform-service/app/services/google_connector_service.py`
- [Background automation](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/workers/tasks.py): `backend/core-platform-service/app/workers/tasks.py`

### Platform services

- [PostgreSQL and pgvector](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/db/database.py): `backend/core-platform-service/app/db/database.py`
- [Lifecycle event bus](https://github.com/suyash-sahu/enterpise-ai-workspace/blob/main/backend/core-platform-service/app/events/publisher.py): `backend/core-platform-service/app/events/publisher.py`

### Other components

- **Workspace user**

## Connections

- Workspace user → Workspace UI: submits request
- Workspace UI → API router: sends request
- API router → Supervisor loop: routes request
- Supervisor loop → Task decomposition: decomposes request
- Supervisor loop → Privacy routing: routes by sensitivity
- Supervisor loop → Capability registry: dispatches capabilities
- Supervisor loop → Verification and replanning: verifies and replans
- Task execution → Human approval: claims approval
- Capability registry → Task execution: executes capability
- Task execution → Document RAG: runs retrieval task
- Task execution → Database agent: runs query task
- Database agent → Safe SQL execution: executes validated SQL (evidence: `backend/core-platform-service/app/agents/database_agent.py`)
- Safe SQL execution → PostgreSQL and pgvector: reads safely (evidence: `backend/core-platform-service/app/services/database_query_service.py`)
- Document RAG → Google connectors: fetches Drive content (evidence: `backend/core-platform-service/app/rag/pipeline.py`)
- Document RAG → PostgreSQL and pgvector: stores document chunks (evidence: `backend/core-platform-service/app/rag/pipeline.py`)
- Work AI proposals → Human approval: creates approval (evidence: `backend/core-platform-service/app/services/work_ai/pipeline.py`)
- Work AI proposals → Projects and tasks: validates work items (evidence: `backend/core-platform-service/app/services/work_ai/pipeline.py`)
- Work AI proposals → Task execution: dispatches approved work (evidence: `backend/core-platform-service/app/services/work_ai/pipeline.py`)
- Background automation → Document RAG: ingests Drive files (evidence: `backend/core-platform-service/app/workers/tasks.py`)
- Background automation → Google connectors: syncs Drive files (evidence: `backend/core-platform-service/app/workers/tasks.py`)
- Human approval → Lifecycle event bus: publishes lifecycle events (evidence: `backend/core-platform-service/app/services/approval/approval_service.py`)
- Workspace user → Google connectors: connects Google account
- Workspace user → Evaluation harness: runs comparisons
