# robusta-dev/holmesgpt architecture

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

- Interactive diagram: https://gitdiagram.com/robusta-dev/holmesgpt
- Repository: https://github.com/robusta-dev/holmesgpt

## Overview

##### Main Components
- Interface/CLI & Web UI: Users can interact via a CLI (holmes.py, server.py, config settings) or a web-based interface (as deployed via helm charts and Docker images).
- Core Engine: Located under “holmes/core”, this module includes the investigation logic, conversation handling, integration with LLM models, fetching and formatting of observability data, and performance timing. This is the brain of the application.
- Utility Modules: In “holmes/common” and “holmes/utils”, supporting functions like environment variable handling, caching, certificate utilities, and file operations are provided.
- Configuration: The project uses configuration files (“config.example.yaml”, and user config files in ~/.holmes/config.yaml) to decide which plugins, toolsets, and runbooks to load. This also supports extensibility and customization.
- Deployment & Build: Supporting infrastructure files such as Dockerfile, Helm charts (in the helm directory) and Makefile illustrate how the application can be containerized and deployed – often in a Kubernetes cluster.

##### Relationships and Interactions
- User requests (or alert events) are received through the CLI or web interface.
- The core engine interprets the request and initiates an “agentic loop” that:
- Calls upon various plugins to retrieve data (logs, metrics, traces) from integrated datasources.
- Formats and processes the responses (e.g., via “holmes/core/llm.py” and “holmes/core/tools.py”).
- The plugins interact with external systems (Kubernetes, Grafana, Helm, etc.) and return the necessary observability information.
- The processed result is then either displayed to the user (CLI response or via an integrated dashboard) or pushed back into a third-party system (like posting an analysis on Slack).

##### Architectural Patterns and Design Principles
- Modular/Plugin-Based Architecture: Separation of concerns is evident by putting the investigation logic in the core and delegating integrations to plugins.
- Extensibility and Configurability: The approach (via config files and toolsets under “examples/” and “helm”) supports customization for different environments and additional data source integration.
- Clean Separation of Core Logic & I/O: Core modules focus on business logic while plugins handle the interfacing to external web services, CLI input, and even deployment containers.
- Testing and Quality Assurance: A comprehensive “tests” directory (covering unit tests for LLM, investigation structured output, plugin functionality, etc.) shows an emphasis on robust testing.

##### Relevant Technologies, Frameworks, or Libraries
- Python: The main language, as seen in the “holmes” package.
- Docker & Kubernetes: Dockerfile and helm charts indicate containerized deployment and orchestration on Kubernetes clusters.
- CI/CD: GitHub Actions workflows (in “.github/workflows”) are used to build, test, and deploy the project.
- Observability Tools: Built-in support for integrations with platforms like Prometheus, Grafana (Loki and Tempo), PagerDuty, OpsGenie, etc.
- LLM Integration: There’s integration with AI models (provided optionally via API keys) which could reference external LLM services.

##### Elements
- Use clear labels for each of the following components:
- User Interface (CLI and/or Web UI)
- Core Engine (Investigation and Agentic Loop)
- Plugin Modules for Data Sources (and further break down by categories like destinations, toolsets, prompts, etc.)
- Utility/Configuration Manager
- External Dependencies/Services (Kubernetes, Grafana, Prometheus, Slack, and other integrations)
- Deployment Components (Docker, Helm, CI/CD pipelines)
- From user alerts and commands into the core.
- From the core engine to the various plugins.
- From plugins to external services and the return flow of data.

- Drill down into the core to illustrate how it interacts with the plugin system.
- Optionally, include deployment and configuration management components to capture the entire lifecycle from development to production.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        UI_CLI["CLI Interface"]:::ui
        CLI1["holmes.py"]:::cli
        CLI2["server.py"]:::cli
        UI_Web["Web UI Interface"]:::ui
    end

    %% Core Engine
    CoreEngine["Core Engine (Investigation & Agentic Loop)"]:::core

    %% Plugin System
    PluginSys["Plugin System (Data Sources & Runbooks)"]:::plugin

    %% Support Modules
    subgraph "Support Modules"
        Utilities["Utilities"]
        UCommon["Common Modules"]:::util
        UUtils["Utils Modules"]:::util
        ConfigMgr["Configuration Management"]:::config
        ConfigExample["config.example.yaml"]:::config
        HolmesConfig["holmes/config.py"]:::config
    end

    %% Deployment & Build Infrastructure
    subgraph "Deployment & Build"
        DockerfileNode["Dockerfile"]:::deploy
        MakefileNode["Makefile"]:::deploy
        HelmDeploy["Helm Charts (holmes)"]:::deploy
        CICD["CI/CD Pipelines (.github/workflows)"]:::deploy
    end

    %% External Systems
    subgraph "External Systems"
        Kubernetes["Kubernetes"]:::external
        Grafana["Grafana"]:::external
        Prometheus["Prometheus"]:::external
        Slack["Slack"]:::external
    end

    %% Flow Connections
    %% User Interface to Core Engine
    UI_CLI -->|"sends commands"| CoreEngine
    UI_Web -->|"sends requests"| CoreEngine
    CLI1 -->|"initiate from CLI"| UI_CLI
    CLI2 -->|"initiate from CLI"| UI_CLI

    %% Core Engine interacting with Support Modules
    ConfigExample -->|"loads configuration"| CoreEngine
    HolmesConfig -->|"loads configuration"| CoreEngine
    UCommon -->|"provides utilities to"| CoreEngine
    UUtils -->|"provides utils to"| CoreEngine

    %% Core Engine invokes Plugin System
    CoreEngine -->|"invokes data fetch"| PluginSys

    %% Plugin System interacts with External Systems
    PluginSys -->|"retrieves alerts"| Kubernetes
    PluginSys -->|"fetches dashboards"| Grafana
    PluginSys -->|"queries metrics"| Prometheus
    PluginSys -->|"sends notifications"| Slack

    %% Deployment influences UI and Core Engine
    DockerfileNode -->|"containerizes"| CoreEngine
    DockerfileNode -->|"containerizes"| UI_Web
    HelmDeploy -->|"deploys"| UI_Web
    MakefileNode ---|"build automation"| CoreEngine
    CICD -->|"CI/CD pipelines"| CoreEngine

    %% Classes and Styles
    classDef ui fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef cli fill:#FDEBD0,stroke:#D35400,stroke-width:2px;
    classDef core fill:#D6EAF8,stroke:#2471A3,stroke-width:2px;
    classDef plugin fill:#D5F5E3,stroke:#28B463,stroke-width:2px;
    classDef util fill:#FCF3CF,stroke:#F1C40F,stroke-width:2px;
    classDef config fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef deploy fill:#D2B4DE,stroke:#7D3C98,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px;

    %% Click Events for Component Mapping
    click CLI1 "https://github.com/robusta-dev/holmesgpt/blob/master/holmes.py"
    click CLI2 "https://github.com/robusta-dev/holmesgpt/blob/master/server.py"
    click UI_Web "https://github.com/robusta-dev/holmesgpt/tree/master/helm/holmes"
    click CoreEngine "https://github.com/robusta-dev/holmesgpt/tree/master/holmes/core"
    click PluginSys "https://github.com/robusta-dev/holmesgpt/tree/master/holmes/plugins"
    click UCommon "https://github.com/robusta-dev/holmesgpt/tree/master/holmes/common"
    click UUtils "https://github.com/robusta-dev/holmesgpt/tree/master/holmes/utils"
    click ConfigExample "https://github.com/robusta-dev/holmesgpt/blob/master/config.example.yaml"
    click HolmesConfig "https://github.com/robusta-dev/holmesgpt/blob/master/holmes/config.py"
    click DockerfileNode "https://github.com/robusta-dev/holmesgpt/tree/master/Dockerfile"
    click MakefileNode "https://github.com/robusta-dev/holmesgpt/tree/master/Makefile"
    click HelmDeploy "https://github.com/robusta-dev/holmesgpt/tree/master/helm/holmes"
    click CICD "https://github.com/robusta-dev/holmesgpt/tree/master/.github/workflows"
```
