π§ AutoML Multi-Agent System (MCP + Supabase + PyTorch + GCP) π Team Size: 4 Members Each member builds one independent AI Agent.
π Overview This project is a multi-agent AutoML pipeline built using: β’ MCP Server (for orchestration and chatbot integration) β’ Supabase (for centralized database + message storage) β’ Google Cloud Storage (GCP) (for dataset & model storage) β’ PyTorch (for model training & evaluation) β’ Gemini LLM (for reasoning in Planner Agent) Each agent handles one stage of the ML workflow β from dataset discovery to final evaluation β and all communication happens through Supabase tables (no direct API calls between agents).
βοΈ System Architecture User β MCP Server (chatbot) βββ Planner Agent β creates project plan βββ Dataset Agent β fetches & uploads dataset βββ Training Agent β trains model locally βββ Evaluation Agent β evaluates trained model β Supabase (Database) β GCP Bucket (Storage)
π§© Agent Responsibilities Agent Member Description π§ Planner Agent Member 1 Interprets user intent (via Gemini), creates project plan in Supabase (projects table). π¦ Dataset Agent Member 2 Authenticates Kaggle, downloads dataset, uploads to GCP, updates datasets table. βοΈ Training Agent Member 3 Downloads dataset from GCP, trains PyTorch model locally, uploads model to GCP, updates models. π Evaluation Agent Member 4 Evaluates trained model using test data, logs accuracy and metrics, marks project as completed.
π§± Database Schema (Supabase) Core Tables create table if not exists projects ( id uuid primary key default gen_random_uuid(), user_id uuid references users(id) on delete cascade, name text not null, task_type text not null, framework text default 'pytorch', dataset_source text default 'kaggle', search_keywords text[], status text default 'draft', metadata jsonb default '{}'::jsonb, created_at timestamptz default now(), updated_at timestamptz default now() );
create table if not exists datasets ( id uuid primary key default gen_random_uuid(), project_id uuid references projects(id) on delete cascade, name text, gcs_url text, size text, source text default 'kaggle', created_at timestamptz default now() );
create table if not exists models ( id uuid primary key default gen_random_uuid(), project_id uuid references projects(id) on delete cascade, name text, framework text default 'pytorch', gcs_url text, accuracy numeric, metadata jsonb default '{}'::jsonb, created_at timestamptz default now() );
create table if not exists agent_logs ( id uuid primary key default gen_random_uuid(), project_id uuid references projects(id) on delete cascade, agent_name text, message text, log_level text default 'info', created_at timestamptz default now() ); Existing Chat Tables (already in your MCP) users, messages, embeddings
βοΈ GCP Bucket Structure gs://automl-datasets/ βββ raw/ β βββ plantvillage.zip β βββ chestxray.zip βββ models/ β βββ plantvillage_model.pth βββ temp/ βββ intermediate/ Naming convention: β’ Dataset files: raw/{dataset_name}.zip β’ Models: models/{project_name}_model.pth
β‘ Workflow Summary Step Agent Input Output Supabase Status 1οΈβ£ Planner Agent User message JSON project plan pending_dataset 2οΈβ£ Dataset Agent Project ID GCS dataset URL pending_training 3οΈβ£ Training Agent Dataset URL GCS model file pending_evaluation 4οΈβ£ Evaluation Agent Model + dataset Accuracy + metrics completed All coordination happens through projects.status.
π§© MCP Server Integration Folder Structure AutoML-MCP-Agents/ βββ mcp_server/ β βββ main.py βββ agents/ β βββ planner/ β β βββ main.py β β βββ architecture.md β βββ dataset/ β β βββ main.py β β βββ architecture.md β βββ training/ β β βββ main.py β β βββ architecture.md β βββ evaluation/ β βββ main.py β βββ architecture.md βββ README.md β (this file) βββ requirements.txt βββ .env
π§ MCP Configuration (Example) In mcp.yaml or config.json: tools:
- name: planner path: ./agents/planner/main.py
- name: dataset path: ./agents/dataset/main.py
- name: training path: ./agents/training/main.py
- name: evaluation path: ./agents/evaluation/main.py Each tool registers itself when the MCP Server starts.
π Environment Variables Create a .env file at root: SUPABASE_URL= SUPABASE_KEY= GCP_BUCKET_NAME= GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json GEMINI_API_KEY= MCP_API_KEY= LOG_LEVEL=INFO Each agent reads the same env file (shared configs).
π§° Local Setup Instructions 1οΈβ£ Clone the repo git clone https://github.com//AutoML-MCP-Agents.git cd AutoML-MCP-Agents 2οΈβ£ Create a Python environment python -m venv venv source venv/bin/activate # (Linux/Mac) venv\Scripts\activate # (Windows) 3οΈβ£ Install dependencies pip install -r requirements.txt 4οΈβ£ Run the MCP server cd mcp_server uvicorn main:app --reload 5οΈβ£ Run an agent (example) cd ../agents/training python main.py Each agent can be run locally or inside a lightweight Docker container.
π§© How Agents Communicate All agents are stateless and interact through Supabase: β’ Planner inserts β projects β’ Dataset reads β inserts β updates status β’ Training reads β inserts model β updates status β’ Evaluation reads β updates metrics β finalizes project
π§Ύ Testing End-to-End Stage Input Expected Outcome π§ Planner βTrain a PyTorch model for tomato leavesβ Project appears in Supabase with pending_dataset. π¦ Dataset Kaggle key uploaded Dataset uploaded to GCP; status β pending_training. βοΈ Training Trigger by MCP Model trained locally, uploaded to GCP; status β pending_evaluation. π Evaluation Auto-trigger Metrics computed, status β completed. β Output Chatbot shows: βModel accuracy 93.8%. Project complete!β
π§© Team Member Division Member Agent Key Skills Used 1οΈβ£ Planner Agent LLM integration, Supabase schema design 2οΈβ£ Dataset Agent Kaggle API, GCP uploads, data management 3οΈβ£ Training Agent PyTorch model training, file upload 4οΈβ£ Evaluation Agent Model evaluation, metric computation
π Security Guidelines β’ Never store user kaggle.json beyond the session. β’ Restrict Supabase service keys (write-only for agents). β’ Use least-privilege service accounts for GCP uploads. β’ Validate all Supabase input before insert/update. β’ Ensure model training runs locally in isolated environment (no untrusted code).
π§ Future Enhancements β’ Add Auto Hyperparameter Tuner Agent. β’ Introduce Model Comparison Dashboard (Supabase + Streamlit). β’ Add Docker Compose file for one-click setup. β’ Add RAG Agent later (to remember past model results). β’ Enable optional GPU cloud training via RunPod or Vertex AI.
β End-to-End Summary Layer Description Frontend MCP Chatbot for user interaction Middleware MCP Server routes requests to correct agent Backend 4 independent AI Agents (Planner, Dataset, Training, Evaluation) Database Supabase stores metadata, messages, logs Storage GCP bucket stores large datasets & trained models Execution Local PyTorch for training & evaluation Output Metrics + accuracy summary displayed in chat
πΈ Example Final Flow User: "Train a PyTorch model for plant disease detection" β Planner Agent β Creates project plan β Dataset Agent β Fetches dataset from Kaggle β Uploads to GCP β Training Agent β Downloads dataset β Trains model β Uploads .pth to GCP β Evaluation Agent β Evaluates model β Updates Supabase β Chatbot β "β Training complete. Accuracy: 93.8%."