# genia-dev/genia architecture

> Architecture diagram of the GitHub repository genia-dev/genia, 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/genia-dev/genia
- Repository: https://github.com/genia-dev/genia

## Overview

##### Main Components Identification

The system should be divided into these core components:

a) User Interface Layer:
- Slack Integration
- Streamlit Web App
- Shell Interface

b) Core Processing Layer:
- Agent System
- LLM Function Management
- Conversation Management
- Token Management

c) Tools Integration Layer:
- AWS Services
- Kubernetes
- GitHub
- Argo
- Jenkins
- PagerDuty
- Slack
- OPA (Open Policy Agent)

##### Component Relationships

a) External Interfaces:
- OpenAI/Azure API integration
- Connections to cloud services
- Tool integrations

b) Internal Flow:
- User request flow through the system
- LLM processing pipeline
- Tool execution flow

##### Specific Implementation Details

- Blue rectangles: Core services
- Green hexagons: External integrations
- Yellow diamonds: Processing components
- Orange circles: User interfaces

**[User Interfaces]**
- ↓
**[Authentication/Authorization]**
- ↓
**[Agent System]**
- ↓
**[LLM Function Management]**
- ↓
**[Tools Integration Layer]**
- ↓
**[External Services]**

##### Key Technical Elements to Highlight

- Token limiting mechanism
- Conversation state management
- Function calling capabilities
- Tool validation system
- Skills repository

##### Integration Points

Clear connections for:
- OpenAI API integration
- Cloud service connections
- DevOps tool integrations
- Monitoring and alerting systems

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef ui fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef core fill:#FFB6C6,stroke:#333,stroke-width:2px
    classDef tools fill:#98FB98,stroke:#333,stroke-width:2px
    classDef external fill:#FFA07A,stroke:#333,stroke-width:2px
    classDef security fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% User Interface Layer
    subgraph UI["User Interface Layer"]
        Slack["Slack Integration"]:::ui
        Streamlit["Streamlit Web App"]:::ui
        Shell["Shell Interface"]:::ui
    end

    %% Security Layer
    subgraph SEC["Authentication & Authorization"]
        Auth["Auth System"]:::security
        Perm["Permission Management"]:::security
    end

    %% Core Processing Layer
    subgraph CORE["Core Processing Layer"]
        Agent["Agent System"]:::core
        LLM["LLM Function Management"]:::core
        Conv["Conversation Management"]:::core
        Token["Token Management"]:::core
        ToolVal["Tool Validation"]:::core
        Skills["Skills Repository"]:::core
        Config["Configuration"]:::core
        FuncLook["Function Lookup"]:::core
    end

    %% Tools Integration Layer
    subgraph TOOLS["Tools Integration Layer"]
        AWS["AWS Services"]:::tools
        K8s["Kubernetes"]:::tools
        GitHub["GitHub"]:::tools
        Argo["Argo"]:::tools
        Jenkins["Jenkins"]:::tools
        PagerDuty["PagerDuty"]:::tools
        SlackTool["Slack"]:::tools
        OPA["OPA"]:::tools
    end

    %% External Services
    subgraph EXT["External Services"]
        OpenAI["OpenAI/Azure API"]:::external
        Cloud["Cloud Services"]:::external
    end

    %% Relationships
    UI --> SEC
    SEC --> CORE
    CORE --> TOOLS
    TOOLS --> EXT

    %% Click events
    click Slack "https://github.com/genia-dev/GeniA/blob/main/genia/user_interface/slack_app.py"
    click Streamlit "https://github.com/genia-dev/GeniA/blob/main/genia/user_interface/streamlit_app.py"
    click Shell "https://github.com/genia-dev/GeniA/blob/main/genia/user_interface/shell_app.py"
    click Agent "https://github.com/genia-dev/GeniA/tree/main/genia/agents/"
    click LLM "https://github.com/genia-dev/GeniA/tree/main/genia/llm_function/"
    click Conv "https://github.com/genia-dev/GeniA/blob/main/genia/conversation/llm_conversation.py"
    click Token "https://github.com/genia-dev/GeniA/blob/main/genia/token_limiter/token_limiter_openai.py"
    click AWS "https://github.com/genia-dev/GeniA/tree/main/genia/tools/aws_client/"
    click K8s "https://github.com/genia-dev/GeniA/tree/main/genia/tools/kubernetes_client/"
    click GitHub "https://github.com/genia-dev/GeniA/tree/main/genia/tools/github_client/"
    click Argo "https://github.com/genia-dev/GeniA/tree/main/genia/tools/argo/"
    click Jenkins "https://github.com/genia-dev/GeniA/tree/main/genia/tools/jenkins/"
    click PagerDuty "https://github.com/genia-dev/GeniA/tree/main/genia/tools/pagerduty_client/"
    click SlackTool "https://github.com/genia-dev/GeniA/tree/main/genia/tools/slack/"
    click OPA "https://github.com/genia-dev/GeniA/tree/main/genia/tools/opa/"
    click ToolVal "https://github.com/genia-dev/GeniA/blob/main/genia/tool_validators/llm_tool_validator.py"
    click Skills "https://github.com/genia-dev/GeniA/blob/main/genia/tools/skills/skills_repository.py"
    click Config "https://github.com/genia-dev/GeniA/tree/main/genia/tools_config/"
    click FuncLook "https://github.com/genia-dev/GeniA/tree/main/genia/llm_function_lookup_strategy/"

    %% Legend
    subgraph Legend
        UI_L["User Interface"]:::ui
        CORE_L["Core Processing"]:::core
        TOOLS_L["Tools"]:::tools
        EXT_L["External"]:::external
        SEC_L["Security"]:::security
    end
```
