# bangoc123/protonx-agent-01-class architecture

> Architecture diagram of the GitHub repository bangoc123/protonx-agent-01-class, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bangoc123/protonx-agent-01-class
- Repository: https://github.com/bangoc123/protonx-agent-01-class

## Overview

##### Project Type and Purpose
- The README (“ProtonX Agent Class 01”) and the link (presumably to a course page) indicate that this project is used in an educational setting to illustrate how agents (or “MCP” servers/clients) interact.
- The examples range from simple agents (like rag-practice) to more structured client/server demos (mcp-server-demo, rag-mcp-server, simple-mcp, weather-demo). They focus on agent-driven interactions, vector search/building, and the use of databases (both binary files and SQLite for “chroma”).

##### File Structure
- At the top level, you have multiple “Day” directories that group different exercises/demos.
- Within Day‑2, the “rag-practice” folder includes files for vector search (“build-vector-search.py”) and agent components (“rag.py”, “rag-agent.py”, and even a “simple-react-agent.py”). The associated “db” folder holds data files (binary files organized in unique identifier directories) and a SQLite database (“chroma.sqlite3”). This indicates that the system interacts with both low-level binary structures and higher-level retrieval structures.
- Day‑3 contains several subprojects:
- “practice-in-class/mcp-server-demo” shows a classical client-server architecture (client.py and server.py).
- “rag-mcp” mirrors the rag-practice structure but in the context of an MCP server, complete with its own database, supporting files like prompts.py and tools.py.
- “simple-mcp” breaks down the core concepts (prompt, resource, server, tool) into separate directories. This reinforces the idea of modular, component-based design.
- “weather-demo” further shows how a complete client-server system can interact, likely integrating weather data with the MCP agent framework.
- Consistent use of configuration files (like pyproject.toml, requirements.txt, .python-version, and uv.lock) which implies a reliance on Python’s ecosystem and environment management.

##### Main Components of the System
- Agent Modules: These include files like rag.py, rag-agent.py, and the various server.py in the different demos. They are responsible for handling agent logic.
- Client Modules: Some demos manifest a clear client component (e.g., client.py in mcp-server-demo and weather-demo).
- Database Layer: There is a low-level “db” folder with binary files (data_level0.bin, link_lists.bin, etc.) and an SQLite file (chroma.sqlite3). This is used for storing and retrieving vector indexes and possibly prompt or tool data.
- Core Concept Modules: In simple-mcp, the separation of “prompt-concept”, “resource-concept”, “server-concept”, and “tool-concept” emphasizes modular decomposition of agent capabilities.

##### Relationships and Interactions
- Data Flow: Clients (e.g., in mcp-server-demo or weather-demo) send requests to the Server (MCP or RAG based) which in turn queries the vector database (or uses prompt/tools modules) to respond.
- Agents might be abstracted as “middleware” that integrates the retrieval component (vector search from database files) with appropriate decision-making or tool invocation (as seen in simple-mcp).
- In the rag-mcp folder, you see a clear structure indicating that prompts, tools, and databases work in unison within a server process.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Day-2: Rag Practice
    subgraph "Day-2: Rag Practice"
        ragAgent["RAG Agent (rag-agent.py)"]:::agent
        rag["RAG (rag.py)"]:::agent
        simpleReact["Simple React Agent (simple-react-agent.py)"]:::agent
        dbRagPractice["Vector Search & Chroma DB"]:::db
    end
    ragAgent --> dbRagPractice
    rag --> dbRagPractice
    simpleReact --> dbRagPractice

    %% Day-3: MCP Server Demo
    subgraph "Day-3: MCP Server Demo"
        mcpDemoClient["MCP Demo Client"]:::client
        mcpDemoServer["MCP Demo Server"]:::server
    end
    mcpDemoClient --> mcpDemoServer

    %% Day-3: RAG-MCP Server
    subgraph "Day-3: RAG-MCP Server"
        ragMcpServer["RAG-MCP Server"]:::server
        ragMcpAgentClient["Agent Client"]:::agent
        ragMcpPrompts["Prompts"]:::agent
        ragMcpTools["Tools"]:::agent
        dbRagMcp["RAG-MCP DB"]:::db
    end
    ragMcpServer --> dbRagMcp
    ragMcpServer --> ragMcpPrompts
    ragMcpServer --> ragMcpTools
    ragMcpAgentClient --> ragMcpServer

    %% Day-3: Simple MCP
    subgraph "Day-3: Simple MCP"
        simpleMcpServer["Overall simple-mcp Server"]:::server
        promptConcept["Prompt Concept"]:::core
        resourceConcept["Resource Concept"]:::core
        serverConcept["Server Concept"]:::core
        fakeDatabase["Fake Database"]:::db
        toolConcept["Tool Concept"]:::core
    end
    simpleMcpServer --> promptConcept
    simpleMcpServer --> resourceConcept
    simpleMcpServer --> serverConcept
    simpleMcpServer --> toolConcept
    serverConcept --> fakeDatabase

    %% Day-3: Weather Demo
    subgraph "Day-3: Weather Demo"
        weatherClient["Weather Demo Client"]:::client
        weatherServer["Weather Demo Server"]:::server
    end
    weatherClient --> weatherServer

    %% Click Events
    click ragAgent "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-2/rag-practice/rag-agent.py"
    click rag "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-2/rag-practice/rag.py"
    click simpleReact "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-2/rag-practice/simple-react-agent.py"
    click dbRagPractice "https://github.com/bangoc123/protonx-agent-01-class/tree/master/Day-2/rag-practice/db"

    click mcpDemoClient "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/practice-in-class/mcp-server-demo/client.py"
    click mcpDemoServer "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/practice-in-class/mcp-server-demo/server.py"

    click ragMcpServer "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/rag-mcp/rag-mcp-server/server.py"
    click ragMcpAgentClient "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/rag-mcp/rag-mcp-server/agent-client.py"
    click ragMcpPrompts "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/rag-mcp/rag-mcp-server/prompts.py"
    click ragMcpTools "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/rag-mcp/rag-mcp-server/tools.py"
    click dbRagMcp "https://github.com/bangoc123/protonx-agent-01-class/tree/master/Day-3/rag-mcp/rag-mcp-server/db"

    click promptConcept "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/simple-mcp/core-concepts/prompt-concept/server.py"
    click resourceConcept "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/simple-mcp/core-concepts/resource-concept/server.py"
    click serverConcept "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/simple-mcp/core-concepts/server-concept/server.py"
    click fakeDatabase "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/simple-mcp/core-concepts/server-concept/fake_database.py"
    click toolConcept "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/simple-mcp/core-concepts/tool-concept/server.py"
    click simpleMcpServer "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/simple-mcp/server.py"

    click weatherClient "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/weather-demo/weather-mcp-client/client.py"
    click weatherServer "https://github.com/bangoc123/protonx-agent-01-class/blob/master/Day-3/weather-demo/weather-mcp-server/server.py"

    %% Styles
    classDef agent fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef client fill:#add8e6,stroke:#0000cc,stroke-width:2px;
    classDef server fill:#d4f7d4,stroke:#339933,stroke-width:2px;
    classDef db fill:#fff3b0,stroke:#e6b800,stroke-width:2px;
    classDef core fill:#d0f0c0,stroke:#669966,stroke-width:2px;
```
