# kvkrpm/business-intelligence-agent architecture

> Architecture diagram of the GitHub repository kvkrpm/business-intelligence-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kvkrpm/business-intelligence-agent
- Repository: https://github.com/kvkrpm/business-intelligence-agent

## Overview

This is a Streamlit founder-focused BI agent that answers questions using live Monday.com Deals and Work Orders data. A user submits a question in the chat; the agent selects a rule-based analysis, fetches the relevant board data, computes metrics, and returns an answer with visible action traces. The product covers quarterly pipeline, closed revenue, win rate, data-quality reporting, and delivered-revenue execution insights. Edges reflect calls visible in excerpts or relationships explicitly documented in the README; the normalizer is present but no use of it is shown.

Main entry points: [`app/agent/agent.py`](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/agent/agent.py) (Question agent), [`app/tools/monday_api.py`](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/monday_api.py) (Board data fetch), [`streamlit_app.py`](https://github.com/kvkrpm/business-intelligence-agent/blob/main/streamlit_app.py) (Streamlit chat), [`app/config/settings.py`](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/config/settings.py) (API and board settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_chat["Streamlit chat<br/>[streamlit_app.py]"]
end

subgraph group_orchestration["Agent orchestration"]
  node_agent["Question agent<br/>[agent.py]"]
end

subgraph group_integration["Monday integration"]
  node_monday_api["Board data fetch<br/>[monday_api.py]"]
  node_settings["API and board settings<br/>[settings.py]"]
end

subgraph group_analytics["Business analytics"]
  node_pipeline["Quarterly pipeline<br/>[metrics.py]"]
  node_closed_revenue["Closed revenue<br/>[metrics.py]"]
  node_win_rate["Win rate<br/>[metrics.py]"]
  node_data_quality["Data quality report<br/>[metrics.py]"]
  node_delivered["Delivered revenue<br/>[metrics.py]"]
  node_normalizer["Normalization helpers<br/>[normalizer.py]"]
end

node_founder(("Founder or executive"))
node_monday["Monday.com GraphQL API"]

node_founder -->|"asks question"| node_chat
node_chat -->|"runs query"| node_agent
node_agent -->|"fetches boards"| node_monday_api
node_monday_api -->|"queries boards"| node_monday
node_agent -->|"reads board IDs"| node_settings
node_monday_api -->|"reads API config"| node_settings
node_agent -->|"computes pipeline"| node_pipeline
node_agent -->|"computes revenue"| node_closed_revenue
node_agent -->|"computes win rate"| node_win_rate
node_agent -->|"checks data quality"| node_data_quality
node_agent -->|"computes delivery"| node_delivered

click node_chat "https://github.com/kvkrpm/business-intelligence-agent/blob/main/streamlit_app.py"
click node_agent "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/agent/agent.py"
click node_monday_api "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/monday_api.py"
click node_settings "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/config/settings.py"
click node_pipeline "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py"
click node_closed_revenue "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py"
click node_win_rate "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py"
click node_data_quality "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py"
click node_delivered "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py"
click node_normalizer "https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/normalizer.py"

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_chat toneBlue
class node_agent toneAmber
class node_monday_api,node_settings,node_monday toneMint
class node_pipeline,node_closed_revenue,node_win_rate,node_data_quality,node_delivered,node_normalizer toneRose
class node_founder toneIndigo
```

## Components

### User interface

- [Streamlit chat](https://github.com/kvkrpm/business-intelligence-agent/blob/main/streamlit_app.py): `streamlit_app.py`

### Agent orchestration

- [Question agent](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/agent/agent.py): `app/agent/agent.py`

### Monday integration

- [Board data fetch](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/monday_api.py): `app/tools/monday_api.py`
- [API and board settings](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/config/settings.py): `app/config/settings.py`

### Business analytics

- [Quarterly pipeline](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py): `app/tools/metrics.py`
- [Closed revenue](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py): `app/tools/metrics.py`
- [Win rate](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py): `app/tools/metrics.py`
- [Data quality report](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py): `app/tools/metrics.py`
- [Delivered revenue](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/metrics.py): `app/tools/metrics.py`
- [Normalization helpers](https://github.com/kvkrpm/business-intelligence-agent/blob/main/app/tools/normalizer.py): `app/tools/normalizer.py`

### Other components

- **Founder or executive**
- **Monday.com GraphQL API**

## Connections

- Founder or executive → Streamlit chat: asks question (evidence: `streamlit_app.py`)
- Streamlit chat → Question agent: runs query (evidence: `streamlit_app.py`)
- Question agent → Board data fetch: fetches boards (evidence: `app/agent/agent.py`)
- Board data fetch → Monday.com GraphQL API: queries boards (evidence: `app/tools/monday_api.py`)
- Question agent → API and board settings: reads board IDs (evidence: `app/agent/agent.py`)
- Board data fetch → API and board settings: reads API config (evidence: `app/tools/monday_api.py`)
- Question agent → Quarterly pipeline: computes pipeline (evidence: `app/agent/agent.py`)
- Question agent → Closed revenue: computes revenue (evidence: `app/agent/agent.py`)
- Question agent → Win rate: computes win rate (evidence: `app/agent/agent.py`)
- Question agent → Data quality report: checks data quality (evidence: `app/agent/agent.py`)
- Question agent → Delivered revenue: computes delivery (evidence: `app/agent/agent.py`)
