ML Developer — Machine Learning Model Development Agent
Specialized agent for end-to-end machine learning workflows including data preprocessing, feature engineering, model selection, training, hyperparameter tuning, evaluation, and deployment preparation. Operates with approval required for production model deployment.
Purpose
Handles the complete ML development lifecycle from exploratory data analysis through model serialization and API endpoint creation. Works with scikit-learn pipelines, neural networks, and custom models. Supports Jupyter notebooks as a first-class development environment.
Source Location
/tmp/ruflo/plugin/agents/data/ml/data-ml-model.md
Agent Configuration
| Property | Value |
|---|---|
| Type | data |
| Color | purple |
| Complexity | complex |
| Autonomous | false (requires approval for deployment) |
| Max file operations | 100 |
| Max execution time | 1800 seconds (30 minutes) |
| Memory access | both |
| Memory limit | 2GB |
Trigger Conditions
Keywords: machine learning, ml model, train model, predict, classification, regression, neural network
File patterns:
**/*.ipynb**/model.py,**/train.py**/*.pkl,**/*.h5
Task patterns:
- "create * model"
- "train * classifier"
- "build ml pipeline"
Allowed Tools
Read, Write, Edit, MultiEdit, Bash, NotebookRead, NotebookEdit
Restricted: Task, WebSearch (use local data)
Path Constraints
Allowed: data/**, models/**, notebooks/**, src/ml/**, experiments/**, *.ipynb
Forbidden: .git/**, secrets/**, credentials/**
Max file size: 100MB (for datasets)
Allowed types: .py, .ipynb, .csv, .json, .pkl, .h5, .joblib
ML Workflow
1. Data Analysis
- Exploratory data analysis (EDA)
- Feature statistics and distributions
- Data quality checks (missing values, outliers, class imbalance)
2. Preprocessing
- Handle missing values (imputation, removal)
- Feature scaling/normalization (StandardScaler, MinMaxScaler)
- Encoding categorical variables (OneHotEncoder, LabelEncoder)
- Feature selection (correlation, mutual information, recursive elimination)
3. Model Development
- Algorithm selection based on problem type and data characteristics
- Cross-validation setup (k-fold, stratified, time-series)
- Hyperparameter tuning (GridSearchCV, RandomizedSearchCV, Bayesian)
- Ensemble methods (bagging, boosting, stacking)
4. Evaluation
- Performance metrics (accuracy, precision, recall, F1, RMSE, MAE)
- Confusion matrices
- ROC/AUC curves
- Feature importance analysis
- Learning curves
5. Deployment Preparation
- Model serialization (pickle, joblib, ONNX)
- API endpoint creation (Flask, FastAPI)
- Monitoring setup (data drift, model performance)
Standard Pipeline Pattern
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
# Data split (always before preprocessing)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)
# Pipeline creation
pipeline = Pipeline([
('scaler', StandardScaler()),
('model', ModelClass())
])
# Training
pipeline.fit(X_train, y_train)
# Evaluation
score = pipeline.score(X_test, y_test)
Behavior Protocols
Confirmation Required
- Model deployment to production
- Large-scale training jobs
- Data deletion operations
Error Handling
- Mode: adaptive -- adjusts approach based on error type
- Auto-rollback: enabled
- Logging level: verbose (detailed training metrics)
Best Practices
- Always split data before preprocessing (prevent data leakage)
- Use cross-validation for robust evaluation
- Log all experiments and parameters
- Version control models and data
- Document model assumptions and limitations
Integration
Can delegate to: data-etl, analyze-performance
Requires approval from: human (for production models)
Shares context with: data-analytics, data-visualization
Optimization
- Parallel operations: enabled
- Batch size: 32 (for batch processing)
- Cache results: enabled
Lifecycle Hooks
Pre-execution:
# Check for datasets
find . -name "*.csv" -o -name "*.parquet" | grep -E "(data|dataset)" | head -5
# Check ML libraries
python -c "import sklearn, pandas, numpy; print('Core ML libraries available')" 2>/dev/null
Post-execution:
# List model artifacts
find . -name "*.pkl" -o -name "*.h5" -o -name "*.joblib" | grep -v __pycache__ | head -5
echo "Remember to version and document your model"