Skip to content

About

Multi-Agent ML Studio for AI-assisted data analysis and machine learning workflows.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Agentic ML Studio

Python Version Framework Tools UI ML License

Agentic ML Studio is a modular, multi-agent machine learning studio that automates end-to-end data science workflows. It unites LangGraph stateful agent orchestration, Model Context Protocol (MCP) tool servers, scikit-learn pipelines, and a local Ollama LLM backend under an intuitive Streamlit multi-page interface.


πŸ“‘ Table of Contents


🌟 Overview

Building baseline machine learning models often involves repetitive steps: profiling datasets, handling missing values, encoding categories, picking algorithms, training pipelines, calculating metrics, and writing reports.

Agentic ML Studio addresses this by deploying specialized, cooperating agents:

  1. Deterministic Operations (e.g., calculating schema, imputing data, fitting regressors, computing $R^2$/MAE/RMSE) are delegated to scikit-learn and pandas.
  2. Tool Protocol Integration is handled via FastMCP stdio servers.
  3. Reasoning & Natural-Language Interpretations are generated using local LLMs (Ollama / LLaMA 3) with automated heuristic fallback.
  4. State Management is coordinated via a compiled LangGraph state machine.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           Streamlit Frontend                            β”‚
β”‚  (00_Dataset | 01_Visualizations | 02_Insights | 03_Training | 04_Reportβ”‚
β”‚                    05_Agentic_Studio Multi-Agent UI)                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β–Ό                                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     LangGraph Agentic Workflow    β”‚ β”‚        FastMCP Tool Servers       β”‚
β”‚                                   β”‚ β”‚                                   β”‚
β”‚  [Data Analysis Agent]            β”‚ β”‚ β€’ Dataset Server (profile/schema) β”‚
β”‚          ↓                        β”‚ β”‚ β€’ Visualization Server (Plotly)   β”‚
β”‚  [Preprocessing Agent]            β”‚ β”‚ β€’ Training Server (fit/save)      β”‚
β”‚          ↓                        β”‚ β”‚ β€’ Reporting Server (export)       β”‚
β”‚  [Model Selection Agent]          β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚          ↓                        β”‚
β”‚  [Training Agent]                 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          ↓                        β”‚ β”‚         LLM Integration           β”‚
β”‚  [Evaluation Agent]               β”‚ β”‚                                   β”‚
β”‚          ↓                        β”‚ β”‚ β€’ Ollama (llama3)                 β”‚
β”‚  [AI Insights Agent]              β”‚ β”‚ β€’ Resilient Heuristic Fallback    β”‚
β”‚          ↓                        β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚  [Reporting Agent]                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

1. πŸ€– Multi-Agent Workflow Orchestration (LangGraph)

  • Data Analysis Agent: Automatically computes dataset shape, schema data types, missing value distributions, duplicate rows, and numeric summary statistics.
  • Preprocessing Agent: Dynamically constructs scikit-learn ColumnTransformer pipelines with median imputation & standard scaling for numeric features, and mode imputation & one-hot encoding for categorical variables.
  • Model Selection Agent: Analyzes dataset characteristics (sample size, feature count, categorical presence) to deterministically select the optimal model, or respects explicit user selections.
  • Training Agent: Executes train-test splitting (80/20) and trains the end-to-end preprocessing + regressor pipeline, persisting models with joblib.
  • Evaluation Agent: Evaluates model predictions on held-out test data, computing genuine $R^2$, MAE, and RMSE metrics.
  • AI Insights Agent: Interprets data quality, explains error metrics, and provides actionable recommendations using Ollama (llama3). Falls back to deterministic heuristics if the LLM is offline.
  • Reporting Agent: Generates and exports a comprehensive Markdown report summarizing the entire execution.

2. πŸ› οΈ Model Context Protocol (MCP) Tool Servers

  • Independent FastMCP stdio servers:
    • dataset_server: Dataset profiling, schema, missing values, duplicates.
    • visualization_server: Interactive Plotly histograms, correlation matrices, and scatter plots.
    • training_server: Linear regression fitting and model serialization.
    • reporting_server: Markdown report compilation.

3. πŸ“Š Interactive Visualizations

  • Real-time Plotly rendering of distributions, correlation heatmaps, and customizable scatter plots.

πŸ”„ Workflow Pipeline

graph TD
    A[Upload / Select Dataset] --> B[Data Analysis Agent]
    B --> C[Preprocessing Agent]
    C --> D[Model Selection Agent]
    D --> E[Training Agent]
    E --> F[Evaluation Agent]
    F --> G[AI Insights Agent]
    G --> H[Reporting Agent]
    H --> I[Downloadable Report & Model Artifact]
Loading

πŸ“ Repository Structure

agentic-ml-studio/
β”œβ”€β”€ .ai/                       # AI coding instructions & workflow specs
β”œβ”€β”€ docs/                      # Project status and documentation
β”‚   └── project_status.md
β”œβ”€β”€ src/
β”‚   └── app/
β”‚       β”œβ”€β”€ agent/             # LangGraph Multi-Agent Engine
β”‚       β”‚   β”œβ”€β”€ nodes/         # Individual agent nodes
β”‚       β”‚   β”‚   β”œβ”€β”€ analysis.py
β”‚       β”‚   β”‚   β”œβ”€β”€ preprocessing.py
β”‚       β”‚   β”‚   β”œβ”€β”€ model_selection.py
β”‚       β”‚   β”‚   β”œβ”€β”€ training.py
β”‚       β”‚   β”‚   β”œβ”€β”€ evaluation.py
β”‚       β”‚   β”‚   β”œβ”€β”€ insights.py
β”‚       β”‚   β”‚   └── reporting.py
β”‚       β”‚   β”œβ”€β”€ state.py       # TypedDict AgentState
β”‚       β”‚   └── workflow.py    # Compiled StateGraph workflow
β”‚       β”œβ”€β”€ llm/               # Ollama LLM integration & prompt templates
β”‚       β”‚   β”œβ”€β”€ ollama_client.py
β”‚       β”‚   └── prompts.py
β”‚       β”œβ”€β”€ mcp/               # Model Context Protocol servers & clients
β”‚       β”‚   β”œβ”€β”€ client/
β”‚       β”‚   β”œβ”€β”€ dataset_server/
β”‚       β”‚   β”œβ”€β”€ reporting_server/
β”‚       β”‚   β”œβ”€β”€ training_server/
β”‚       β”‚   └── visualization_server/
β”‚       β”œβ”€β”€ services/          # Supporting services
β”‚       └── ui/                # Multi-page Streamlit application
β”‚           β”œβ”€β”€ Home.py
β”‚           └── pages/
β”‚               β”œβ”€β”€ 00_Dataset.py
β”‚               β”œβ”€β”€ 01_Visualizations.py
β”‚               β”œβ”€β”€ 02_Insights.py
β”‚               β”œβ”€β”€ 03_Training.py
β”‚               β”œβ”€β”€ 04_Reporting.py
β”‚               └── 05_Agentic_Studio.py
β”œβ”€β”€ storage/                   # Saved datasets, models, and reports
β”‚   β”œβ”€β”€ datasets/
β”‚   β”œβ”€β”€ models/
β”‚   └── reports/
β”œβ”€β”€ tests/                     # Pytest automated test suite
β”œβ”€β”€ pyproject.toml             # Dependencies and build configuration
└── README.md

πŸš€ Installation & Quickstart

Prerequisites

  • Python: >= 3.14
  • uv: Recommended package manager (Install uv)
  • Ollama (Optional): Local LLM runner (Download Ollama). If installed, pull the default model:
    ollama pull llama3

1. Clone & Sync Virtual Environment

git clone https://github.com/pathummadhusanka/agentic-ml-studio.git
cd agentic-ml-studio
uv sync

πŸ–₯️ Usage Guide

1. Running the Full Multi-Agent Studio

Launch the Streamlit web application:

uv run streamlit run src/app/ui/Home.py

Open your browser at http://localhost:8501 and navigate to 05_Agentic_Studio:

  1. Select or upload a CSV dataset.
  2. Choose your numeric target column.
  3. Select a model preference (Auto or a specific model).
  4. Click πŸš€ Run Agentic Workflow.
  5. Inspect real-time agent traces, data quality metrics, trained model performance, AI insights, and download the full Markdown report.

2. Interactive MCP Pages

You can also interact with individual stages independently:

  • 00_Dataset: Upload and inspect schema, missing values, and duplicate rows.
  • 01_Visualizations: Render interactive Plotly histograms, correlation matrices, and scatter plots.
  • 02_Insights: Request AI recommendations on data preprocessing.
  • 03_Training: Fit baseline linear models.
  • 04_Reporting: Export standalone summaries.

3. Running Standalone MCP Servers

To run the FastMCP tool servers over stdio for external agent integrations:

uv run -m app.mcp.dataset_server.server
uv run -m app.mcp.visualization_server.server
uv run -m app.mcp.training_server.server
uv run -m app.mcp.reporting_server.server

πŸ“ˆ Supported Models

Model Key Model Name Description Best Suited For
linear_regression Linear Regression Fast baseline linear model Small datasets, simple linear relationships
decision_tree Decision Tree Regressor Non-linear tree model Moderate datasets, non-linear interactions
random_forest Random Forest Regressor Ensemble of bagging trees Tabular data with mixed features and noise
gradient_boosting Gradient Boosting Regressor Sequential boosting ensemble Large datasets requiring maximum predictive accuracy

πŸ§ͺ Testing

The repository includes a comprehensive automated test suite testing analysis, preprocessing, model selection, training, evaluation, and end-to-end LangGraph execution.

Run the test suite:

uv run pytest

πŸ’Ύ Storage Artifacts

Generated artifacts are automatically persisted in the storage/ directory:

  • storage/datasets/ β€” Uploaded CSV datasets.
  • storage/models/ β€” Serialized scikit-learn pipeline artifacts (.pkl).
  • storage/reports/ β€” Exported markdown reports (.md).

⚠️ Limitations & Roadmap

  • Current Scope: Focuses on tabular regression problems with CSV input.
  • Planned Enhancements:
    • Support for multi-class and binary classification tasks.
    • Hyperparameter tuning agent (GridSearch / Optuna).
    • External LLM provider support (Gemini, OpenAI, Anthropic) alongside Ollama.
    • Model explainability agent (SHAP / feature importances).

πŸ“„ License

This project is licensed under the MIT License.

About

Multi-Agent ML Studio for AI-assisted data analysis and machine learning workflows.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages