# shimaiibrahim/bi-agent- architecture

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

- Interactive diagram: https://gitdiagram.com/shimaiibrahim/bi-agent-
- Repository: https://github.com/shimaiibrahim/bi-agent-

## Overview

This is a multi-agent business intelligence and machine-learning platform: a client submits structured data through the API, which runs schema analysis, LLM-assisted planning, preprocessing, model training and evaluation, then produces a business report and persists artifacts. The README documents the principal staged workflow; `core/workflow.py` confirms its orchestration, while sampled code confirms planner-to-Gemini and model-registry behavior. The API, most agents, and concrete storage implementation were not sampled, so their internal wiring is shown only where documented, and uncertain artifact writes are omitted.

Main entry points: [`core/workflow.py`](https://github.com/shimaiibrahim/bi-agent-/blob/main/core/workflow.py) (Agent Workflow), [`agents/model_agent.py`](https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/model_agent.py) (Model Agent), [`agents/llm_planner_agent.py`](https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/llm_planner_agent.py) (LLM Planner), [`api.py`](https://github.com/shimaiibrahim/bi-agent-/blob/main/api.py) (FastAPI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and Workflow"]
  node_api["FastAPI<br/>[api.py]"]
  node_workflow["Agent Workflow<br/>[workflow.py]"]
end

subgraph group_analysis["Dataset Analysis"]
  node_schema["Schema Agent<br/>[schema_agent.py]"]
  node_planner["LLM Planner"]
  node_planner_prompt["Planning Prompt<br/>[planner_prompt.py]"]
  node_gemini_provider["Gemini Provider<br/>[gemini_provider.py]"]
  node_preprocessing["Preprocessing Agent"]
  node_processing_tools["Data Processing Tools<br/>[process_tools.py]"]
end

subgraph group_modeling["Modeling"]
  node_model_agent["Model Agent<br/>[model_agent.py]"]
  node_splitter["Dataset Splitter<br/>[splitter.py]"]
  node_registry["Model Registry<br/>[registry.py]"]
  node_trainer["Model Trainer<br/>[trainer.py]"]
  node_validator["Model Validator<br/>[validator.py]"]
  node_evaluator["Model Evaluator<br/>[evaluator.py]"]
end

subgraph group_artifacts["Reports and Storage"]
  node_report_agent["Insights Report Agent"]
  node_report_prompt["Report Prompt"]
  node_artifact_store["Artifact Store<br/>[base_store.py]"]
  node_local_store[("Local Store<br/>[local_store.py]")]
end

node_client(("Client"))
node_gemini["Gemini API"]

node_client -->|"submits dataset"| node_api
node_api -->|"starts workflow"| node_workflow
node_workflow -->|"runs"| node_schema
node_workflow -->|"runs"| node_planner
node_workflow -->|"runs"| node_preprocessing
node_workflow -->|"runs"| node_model_agent
node_workflow -->|"runs"| node_report_agent
node_planner -->|"builds prompt"| node_planner_prompt
node_planner -->|"requests plan"| node_gemini_provider
node_gemini_provider -.->|"generates content"| node_gemini
node_preprocessing -->|"applies operations"| node_processing_tools
node_model_agent -->|"splits data"| node_splitter
node_model_agent -->|"loads candidates"| node_registry
node_model_agent -->|"trains models"| node_trainer
node_model_agent -->|"validates models"| node_validator
node_model_agent -->|"evaluates models"| node_evaluator
node_report_agent -->|"builds prompt"| node_report_prompt
node_artifact_store -->|"backed by"| node_local_store

click node_api "https://github.com/shimaiibrahim/bi-agent-/blob/main/api.py"
click node_workflow "https://github.com/shimaiibrahim/bi-agent-/blob/main/core/workflow.py"
click node_schema "https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/schema_agent.py"
click node_planner "https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/llm_planner_agent.py"
click node_planner_prompt "https://github.com/shimaiibrahim/bi-agent-/blob/main/prompts/planner_prompt.py"
click node_gemini_provider "https://github.com/shimaiibrahim/bi-agent-/blob/main/llm/gemini_provider.py"
click node_preprocessing "https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/preprocessing_agent.py"
click node_processing_tools "https://github.com/shimaiibrahim/bi-agent-/blob/main/tools/process_tools.py"
click node_model_agent "https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/model_agent.py"
click node_splitter "https://github.com/shimaiibrahim/bi-agent-/blob/main/models/splitter.py"
click node_registry "https://github.com/shimaiibrahim/bi-agent-/blob/main/models/registry.py"
click node_trainer "https://github.com/shimaiibrahim/bi-agent-/blob/main/models/trainer.py"
click node_validator "https://github.com/shimaiibrahim/bi-agent-/blob/main/models/validator.py"
click node_evaluator "https://github.com/shimaiibrahim/bi-agent-/blob/main/models/evaluator.py"
click node_report_agent "https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/insights_report_agent.py"
click node_report_prompt "https://github.com/shimaiibrahim/bi-agent-/blob/main/prompts/insights_report_prompt.py"
click node_artifact_store "https://github.com/shimaiibrahim/bi-agent-/blob/main/storage/base_store.py"
click node_local_store "https://github.com/shimaiibrahim/bi-agent-/blob/main/storage/local_store.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_api,node_workflow,node_client toneBlue
class node_schema,node_planner,node_planner_prompt,node_gemini_provider,node_preprocessing,node_processing_tools toneAmber
class node_model_agent,node_splitter,node_registry,node_trainer,node_validator,node_evaluator,node_gemini toneMint
class node_report_agent,node_report_prompt,node_artifact_store,node_local_store toneRose
```

## Components

### API and Workflow

- [FastAPI](https://github.com/shimaiibrahim/bi-agent-/blob/main/api.py): `api.py`
- [Agent Workflow](https://github.com/shimaiibrahim/bi-agent-/blob/main/core/workflow.py): `core/workflow.py`

### Dataset Analysis

- [Schema Agent](https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/schema_agent.py): `agents/schema_agent.py`
- [LLM Planner](https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/llm_planner_agent.py): `agents/llm_planner_agent.py`
- [Planning Prompt](https://github.com/shimaiibrahim/bi-agent-/blob/main/prompts/planner_prompt.py): `prompts/planner_prompt.py`
- [Gemini Provider](https://github.com/shimaiibrahim/bi-agent-/blob/main/llm/gemini_provider.py): `llm/gemini_provider.py`
- [Preprocessing Agent](https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/preprocessing_agent.py): `agents/preprocessing_agent.py`
- [Data Processing Tools](https://github.com/shimaiibrahim/bi-agent-/blob/main/tools/process_tools.py): `tools/process_tools.py`

### Modeling

- [Model Agent](https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/model_agent.py): `agents/model_agent.py`
- [Dataset Splitter](https://github.com/shimaiibrahim/bi-agent-/blob/main/models/splitter.py): `models/splitter.py`
- [Model Registry](https://github.com/shimaiibrahim/bi-agent-/blob/main/models/registry.py): `models/registry.py`
- [Model Trainer](https://github.com/shimaiibrahim/bi-agent-/blob/main/models/trainer.py): `models/trainer.py`
- [Model Validator](https://github.com/shimaiibrahim/bi-agent-/blob/main/models/validator.py): `models/validator.py`
- [Model Evaluator](https://github.com/shimaiibrahim/bi-agent-/blob/main/models/evaluator.py): `models/evaluator.py`

### Reports and Storage

- [Insights Report Agent](https://github.com/shimaiibrahim/bi-agent-/blob/main/agents/insights_report_agent.py): `agents/insights_report_agent.py`
- [Report Prompt](https://github.com/shimaiibrahim/bi-agent-/blob/main/prompts/insights_report_prompt.py): `prompts/insights_report_prompt.py`
- [Artifact Store](https://github.com/shimaiibrahim/bi-agent-/blob/main/storage/base_store.py): `storage/base_store.py`
- [Local Store](https://github.com/shimaiibrahim/bi-agent-/blob/main/storage/local_store.py): `storage/local_store.py`

### Other components

- **Client**
- **Gemini API**

## Connections

- Client → FastAPI: submits dataset
- FastAPI → Agent Workflow: starts workflow
- Agent Workflow → Schema Agent: runs
- Agent Workflow → LLM Planner: runs
- Agent Workflow → Preprocessing Agent: runs
- Agent Workflow → Model Agent: runs
- Agent Workflow → Insights Report Agent: runs
- LLM Planner → Planning Prompt: builds prompt
- LLM Planner → Gemini Provider: requests plan
- Gemini Provider → Gemini API: generates content
- Preprocessing Agent → Data Processing Tools: applies operations
- Model Agent → Dataset Splitter: splits data
- Model Agent → Model Registry: loads candidates
- Model Agent → Model Trainer: trains models
- Model Agent → Model Validator: validates models
- Model Agent → Model Evaluator: evaluates models
- Insights Report Agent → Report Prompt: builds prompt
- Artifact Store → Local Store: backed by
