# ro-anderson/multi-agent-rag-customer-support architecture

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

- Interactive diagram: https://gitdiagram.com/ro-anderson/multi-agent-rag-customer-support
- Repository: https://github.com/ro-anderson/multi-agent-rag-customer-support

## Overview

##### Main Components

a) User Interface Layer:
- API Gateway entry point
- User interaction handling

b) Core Application Components:
- Primary Assistant (Controller)
- Specialized Assistants (4 distinct modules)
- Tools Layer (Safe and Sensitive operations)
- Vector Database Interface
- State Management System

c) External Services:
- OpenAI API Integration
- LangSmith Observability
- Qdrant Vector Database

**Top Tier: Client/Interface Layer**
**Middle Tier: Application Core**
**Bottom Tier: Infrastructure/Storage Layer**

##### Component Relationships

- User → Primary Assistant
- Primary Assistant → Specialized Assistants (with routing logic)
- Assistants → Tools
- Tools → Vector Database/External Services
- State Management → All Components

##### Specific Implementation Details

a) Core Flow:
**User Query → Primary Assistant → Specialized Assistant → Tools → Response**

b) State Management Flow:
**Memory Checkpointer ←→ Conversation State ←→ Agent Interactions**

##### Important Elements to Highlight

- RAG Pipeline: Show the connection between vector database and assistants
- Tool Categories: Clearly separate safe and sensitive tools
- Conditional Routing: Illustrate decision points in the graph
- Memory Management: Show state persistence flow

##### Technical Details

- LangChain/LangGraph integration points
- Vector database query flow
- External API connections
- State management checkpoints

##### Architectural Patterns to Emphasize

- Multi-agent system architecture
- Event-driven communication
- RAG pattern implementation
- State machine workflow

##### Specific Components from File Structure

From the file tree, include these key components:
**/app/services/assistants/* → Show all specialized assistants**
**/app/services/tools/* → Display tool categories**
**/app/services/vectordb/* → Show vector database integration**
**/app/core/* → Include core services**

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        API[API Gateway]
        UI[User Interface]
    end

    subgraph "Core Application"
        PA["Primary Assistant"]:::assistant
        
        subgraph "Specialized Assistants"
            CRA["Car Rental Assistant"]:::assistant
            EA["Excursion Assistant"]:::assistant
            FBA["Flight Booking Assistant"]:::assistant
            HBA["Hotel Booking Assistant"]:::assistant
        end
        
        subgraph "Tools Layer"
            direction TB
            CT["Cars Tools"]:::tool
            ET["Excursions Tools"]:::tool
            FT["Flights Tools"]:::tool
            HT["Hotels Tools"]:::tool
            LT["Lookup Tools"]:::tool
        end
        
        subgraph "Core Infrastructure"
            SM["State Management"]:::infra
            LOG["Logger"]:::infra
            SET["Settings"]:::infra
            GS["Graph System"]:::infra
        end
    end

    subgraph "Vector Database System"
        VDI["Vector DB Interface"]:::db
        CHK["Chunkenizer"]:::db
        VDU["Vector DB Utils"]:::db
    end

    subgraph "External Services"
        OAPI["OpenAI API"]:::external
        LS["LangSmith"]:::external
        QDB["Qdrant DB"]:::external
    end

    subgraph "Embedding System"
        EG["Embedding Generator"]:::embed
        VDBI["Vector DB Interface"]:::embed
    end

    %% Relationships
    UI --> API
    API --> PA
    PA --> CRA & EA & FBA & HBA
    CRA --> CT
    EA --> ET
    FBA --> FT
    HBA --> HT
    CT & ET & FT & HT & LT --> VDI
    VDI --> CHK
    VDI --> VDU
    VDI --> QDB
    PA --> OAPI
    PA --> LS
    EG --> VDBI
    VDBI --> QDB
    SM --> PA
    SM --> CRA & EA & FBA & HBA
    LOG --> PA
    SET --> PA
    GS --> PA

    %% Click Events
    click PA "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/assistants/primary_assistant.py"
    click CRA "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/assistants/car_rental_assistant.py"
    click EA "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/assistants/excursion_assistant.py"
    click FBA "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/assistants/flight_booking_assistant.py"
    click HBA "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/assistants/hotel_booking_assistant.py"
    click CT "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/tools/cars.py"
    click ET "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/tools/excursions.py"
    click FT "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/tools/flights.py"
    click HT "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/tools/hotels.py"
    click LT "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/tools/lookup.py"
    click VDI "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/vectordb/vectordb.py"
    click CHK "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/vectordb/chunkenizer.py"
    click VDU "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/services/vectordb/utils.py"
    click SM "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/core/state.py"
    click LOG "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/core/logger.py"
    click SET "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/core/settings.py"
    click GS "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/customer_support_chat/app/graph.py"
    click EG "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/vectorizer/app/embeddings/embedding_generator.py"
    click VDBI "https://github.com/ro-anderson/multi-agent-rag-customer-support/blob/main/vectorizer/app/vectordb/vectordb.py"

    %% Styles
    classDef assistant fill:#3498db,stroke:#2980b9,color:white
    classDef tool fill:#2ecc71,stroke:#27ae60,color:white
    classDef db fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef infra fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef embed fill:#f1c40f,stroke:#f39c12,color:white
```
