# galamo/45600_3_ai architecture

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

- Interactive diagram: https://gitdiagram.com/galamo/45600_3_ai
- Repository: https://github.com/galamo/45600_3_ai

## Overview

This repository is a course workspace of independent agentic-AI labs, not one integrated application. Its examples span conversational agents, SQL/RAG, image search, travel planning, storytelling, and MCP. The graph highlights several substantial workflows and their internal stages; it does not imply that the labs connect to one another. Some subsystems are represented from the file tree and README only, so their internal links are omitted where source evidence was not provided.

Main entry points: [`lab_09_b/server/agents/sql-agent-pipeline.js`](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/sql-agent-pipeline.js) (SQL workflow), [`lab_12/server/src/controllers/image.controller.ts`](https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/controllers/image.controller.ts) (Image API), [`lab_6/server.ts`](https://github.com/galamo/45600_3_ai/blob/main/lab_6/server.ts) (Travel API), [`lab_4/server.js`](https://github.com/galamo/45600_3_ai/blob/main/lab_4/server.js) (Story API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sqlrag["SQL and RAG"]
  node_sqlpipeline["SQL workflow"]
  node_schemaretrieval["Schema retrieval"]
  node_sqlgeneration["SQL generation<br/>[sql-generator.js]"]
  node_dbexecution["Query execution<br/>[db-executor.js]"]
  node_answer["Answer generation<br/>[answer-agent.js]"]
  node_llm["LLM client<br/>[llm.js]"]
  node_schemaindex[("Schema vector store")]
  node_database[("SQL database<br/>[db.js]")]
end

subgraph group_copilot["SSO Copilot"]
  node_copilotui["Chat interface<br/>[App.tsx]"]
  node_chatstate["Chat state<br/>[useChat.ts]"]
  node_chatapi["Chat API client<br/>[api.ts]"]
  node_chatcontroller["Chat endpoints<br/>[chat.controller.ts]"]
  node_chatgraph["Guarded chat graph<br/>[chat.graph.ts]"]
  node_supervisor["Agent supervisor"]
end

subgraph group_imagerag["Image RAG"]
  node_imageclient["Image search UI<br/>[SearchSection.tsx]"]
  node_imageapi["Image API"]
  node_imagesearch["Image search"]
  node_imageindex["Image indexing"]
  node_vectorstore[("Vector store")]
  node_imagefiles["Image storage"]
end

subgraph group_examples["Agent Examples"]
  node_traveler(("Trip planner user"))
  node_travelapi["Travel API<br/>[server.ts]"]
  node_flightagent["Flight planner"]
  node_flightservice["Flight services"]
  node_storyserver["Story API<br/>[server.js]"]
  node_extractor["Story extraction<br/>[extractorAgent.js]"]
  node_storyagent["Story generation<br/>[storyTeller.js]"]
  node_mcpuser(("MCP chat user"))
  node_mcpserver["MCP chat API<br/>[server.js]"]
  node_mcpagent["Tool-using agent<br/>[agent.js]"]
end

node_user(("User"))

node_sqlpipeline -->|"retrieves context"| node_schemaretrieval
node_sqlpipeline -->|"generates SQL"| node_sqlgeneration
node_sqlpipeline -->|"runs query"| node_dbexecution
node_sqlpipeline -->|"forms answer"| node_answer
node_schemaretrieval -->|"retrieves from"| node_schemaindex
node_sqlgeneration -->|"generates with"| node_llm
node_answer -->|"answers with"| node_llm
node_dbexecution -->|"queries"| node_database
node_user -->|"asks"| node_copilotui
node_copilotui -->|"uses chat"| node_chatstate
node_chatstate -->|"calls"| node_chatapi
node_chatcontroller -->|"runs graph"| node_chatgraph
node_chatgraph -->|"dispatches to"| node_supervisor
node_imageclient -.->|"searches via"| node_imageapi
node_imageapi -.->|"delegates search"| node_imagesearch
node_imageapi -.->|"delegates indexing"| node_imageindex
node_imagesearch -.->|"searches vectors"| node_vectorstore
node_imageindex -.->|"indexes vectors"| node_vectorstore
node_imageapi -.->|"stores uploads"| node_imagefiles
node_traveler -->|"requests plan"| node_travelapi
node_travelapi -->|"runs planner"| node_flightagent
node_travelapi -->|"resolves locations"| node_flightservice
node_storyserver -->|"extracts request"| node_extractor
node_storyserver -->|"generates story"| node_storyagent
node_mcpuser -->|"chats"| node_mcpserver
node_mcpserver -->|"calls agent"| node_mcpagent

click node_sqlpipeline "https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/sql-agent-pipeline.js"
click node_schemaretrieval "https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/schema-retriever.js"
click node_sqlgeneration "https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/sql-generator.js"
click node_dbexecution "https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/db-executor.js"
click node_answer "https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/answer-agent.js"
click node_llm "https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/lib/llm.js"
click node_schemaindex "https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/lib/schema-vector-store.js"
click node_database "https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/lib/db.js"
click node_copilotui "https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/client/src/App.tsx"
click node_chatstate "https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/client/src/hooks/useChat.ts"
click node_chatapi "https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/client/src/api.ts"
click node_chatcontroller "https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/server/src/http/chat.controller.ts"
click node_chatgraph "https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/server/src/graph/chat.graph.ts"
click node_supervisor "https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/server/src/agents/supervisor.agent.ts"
click node_imageclient "https://github.com/galamo/45600_3_ai/blob/main/lab_12/client/src/components/SearchSection.tsx"
click node_imageapi "https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/controllers/image.controller.ts"
click node_imagesearch "https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/services/image-search.service.ts"
click node_imageindex "https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/services/image-indexing-agent.service.ts"
click node_vectorstore "https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/services/pgvector.service.ts"
click node_imagefiles "https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/services/image-storage.service.ts"
click node_travelapi "https://github.com/galamo/45600_3_ai/blob/main/lab_6/server.ts"
click node_flightagent "https://github.com/galamo/45600_3_ai/blob/main/lab_6/src/agents/flightPlannerAgent.ts"
click node_flightservice "https://github.com/galamo/45600_3_ai/blob/main/lab_6/src/services/flightApiService.ts"
click node_storyserver "https://github.com/galamo/45600_3_ai/blob/main/lab_4/server.js"
click node_extractor "https://github.com/galamo/45600_3_ai/blob/main/lab_4/extractorAgent.js"
click node_storyagent "https://github.com/galamo/45600_3_ai/blob/main/lab_4/storyTeller.js"
click node_mcpserver "https://github.com/galamo/45600_3_ai/blob/main/lab_9_agent/server.js"
click node_mcpagent "https://github.com/galamo/45600_3_ai/blob/main/lab_9_agent/agent.js"

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_sqlpipeline,node_schemaretrieval,node_sqlgeneration,node_dbexecution,node_answer,node_llm,node_schemaindex,node_database,node_user toneBlue
class node_copilotui,node_chatstate,node_chatapi,node_chatcontroller,node_chatgraph,node_supervisor toneAmber
class node_imageclient,node_imageapi,node_imagesearch,node_imageindex,node_vectorstore,node_imagefiles toneMint
class node_traveler,node_travelapi,node_flightagent,node_flightservice,node_storyserver,node_extractor,node_storyagent,node_mcpuser,node_mcpserver,node_mcpagent toneRose
```

## Components

### SQL and RAG

- [SQL workflow](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/sql-agent-pipeline.js): `lab_09_b/server/agents/sql-agent-pipeline.js`
- [Schema retrieval](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/schema-retriever.js): `lab_09_b/server/agents/schema-retriever.js`
- [SQL generation](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/sql-generator.js): `lab_09_b/server/agents/sql-generator.js`
- [Query execution](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/db-executor.js): `lab_09_b/server/agents/db-executor.js`
- [Answer generation](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/agents/answer-agent.js): `lab_09_b/server/agents/answer-agent.js`
- [LLM client](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/lib/llm.js): `lab_09_b/server/lib/llm.js`
- [Schema vector store](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/lib/schema-vector-store.js): `lab_09_b/server/lib/schema-vector-store.js`
- [SQL database](https://github.com/galamo/45600_3_ai/blob/main/lab_09_b/server/lib/db.js): `lab_09_b/server/lib/db.js`

### SSO Copilot

- [Chat interface](https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/client/src/App.tsx): `lab_09_c/client/src/App.tsx`
- [Chat state](https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/client/src/hooks/useChat.ts): `lab_09_c/client/src/hooks/useChat.ts`
- [Chat API client](https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/client/src/api.ts): `lab_09_c/client/src/api.ts`
- [Chat endpoints](https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/server/src/http/chat.controller.ts): `lab_09_c/server/src/http/chat.controller.ts`
- [Guarded chat graph](https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/server/src/graph/chat.graph.ts): `lab_09_c/server/src/graph/chat.graph.ts`
- [Agent supervisor](https://github.com/galamo/45600_3_ai/blob/main/lab_09_c/server/src/agents/supervisor.agent.ts): `lab_09_c/server/src/agents/supervisor.agent.ts`

### Image RAG

- [Image search UI](https://github.com/galamo/45600_3_ai/blob/main/lab_12/client/src/components/SearchSection.tsx): `lab_12/client/src/components/SearchSection.tsx`
- [Image API](https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/controllers/image.controller.ts): `lab_12/server/src/controllers/image.controller.ts`
- [Image search](https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/services/image-search.service.ts): `lab_12/server/src/services/image-search.service.ts`
- [Image indexing](https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/services/image-indexing-agent.service.ts): `lab_12/server/src/services/image-indexing-agent.service.ts`
- [Vector store](https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/services/pgvector.service.ts): `lab_12/server/src/services/pgvector.service.ts`
- [Image storage](https://github.com/galamo/45600_3_ai/blob/main/lab_12/server/src/services/image-storage.service.ts): `lab_12/server/src/services/image-storage.service.ts`

### Agent Examples

- **Trip planner user**
- [Travel API](https://github.com/galamo/45600_3_ai/blob/main/lab_6/server.ts): `lab_6/server.ts`
- [Flight planner](https://github.com/galamo/45600_3_ai/blob/main/lab_6/src/agents/flightPlannerAgent.ts): `lab_6/src/agents/flightPlannerAgent.ts`
- [Flight services](https://github.com/galamo/45600_3_ai/blob/main/lab_6/src/services/flightApiService.ts): `lab_6/src/services/flightApiService.ts`
- [Story API](https://github.com/galamo/45600_3_ai/blob/main/lab_4/server.js): `lab_4/server.js`
- [Story extraction](https://github.com/galamo/45600_3_ai/blob/main/lab_4/extractorAgent.js): `lab_4/extractorAgent.js`
- [Story generation](https://github.com/galamo/45600_3_ai/blob/main/lab_4/storyTeller.js): `lab_4/storyTeller.js`
- **MCP chat user**
- [MCP chat API](https://github.com/galamo/45600_3_ai/blob/main/lab_9_agent/server.js): `lab_9_agent/server.js`
- [Tool-using agent](https://github.com/galamo/45600_3_ai/blob/main/lab_9_agent/agent.js): `lab_9_agent/agent.js`

### Other components

- **User**

## Connections

- SQL workflow → Schema retrieval: retrieves context (evidence: `lab_09_b/server/agents/sql-agent-pipeline.js`)
- SQL workflow → SQL generation: generates SQL (evidence: `lab_09_b/server/agents/sql-agent-pipeline.js`)
- SQL workflow → Query execution: runs query (evidence: `lab_09_b/server/agents/sql-agent-pipeline.js`)
- SQL workflow → Answer generation: forms answer (evidence: `lab_09_b/server/agents/sql-agent-pipeline.js`)
- Schema retrieval → Schema vector store: retrieves from (evidence: `lab_09_b/server/agents/schema-retriever.js`)
- SQL generation → LLM client: generates with (evidence: `lab_09_b/server/agents/sql-generator.js`)
- Answer generation → LLM client: answers with (evidence: `lab_09_b/server/agents/answer-agent.js`)
- Query execution → SQL database: queries (evidence: `lab_09_b/server/agents/db-executor.js`)
- User → Chat interface: asks (evidence: `lab_09_c/client/src/App.tsx`)
- Chat interface → Chat state: uses chat (evidence: `lab_09_c/client/src/App.tsx`)
- Chat state → Chat API client: calls (evidence: `lab_09_c/client/src/hooks/useChat.ts`)
- Chat endpoints → Guarded chat graph: runs graph (evidence: `lab_09_c/server/src/http/chat.controller.ts`)
- Guarded chat graph → Agent supervisor: dispatches to (evidence: `lab_09_c/server/src/graph/chat.graph.ts`)
- Image search UI → Image API: searches via
- Image API → Image search: delegates search
- Image API → Image indexing: delegates indexing
- Image search → Vector store: searches vectors
- Image indexing → Vector store: indexes vectors
- Image API → Image storage: stores uploads
- Trip planner user → Travel API: requests plan (evidence: `lab_6/server.ts`)
- Travel API → Flight planner: runs planner (evidence: `lab_6/server.ts`)
- Travel API → Flight services: resolves locations (evidence: `lab_6/server.ts`)
- Story API → Story extraction: extracts request (evidence: `lab_4/server.js`)
- Story API → Story generation: generates story (evidence: `lab_4/server.js`)
- MCP chat user → MCP chat API: chats (evidence: `lab_9_agent/server.js`)
- MCP chat API → Tool-using agent: calls agent (evidence: `lab_9_agent/server.js`)
