register-ml-model
About
This skill registers trained models in MLflow's Model Registry with version control and managed stage transitions (Staging, Production, Archived). It implements approval workflows for governance and maintains comprehensive metadata for lineage and deployment tracking. Use it when promoting models from experimentation to production, managing multiple versions, or auditing changes for compliance.
Quick Install
Claude Code
Recommendednpx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/register-ml-modelCopy and paste this command in Claude Code to install this skill
Documentation
Register ML Model
See Extended Examples for complete configuration files and templates.
Implement MLflow Model Registry for systematic model versioning, stage management, and deployment governance.
Cuándo Usar
- Promoting a trained model from experimentation to production
- Managing multiple model versions across development stages
- Implementing model approval workflows for governance
- Tracking model lineage from training to deployment
- Rolling back to previous model versions
- Comparing deployed model versions for A/B testing
- Auditing model changes for compliance requirements
Entradas
- Requerido: MLflow tracking server with Model Registry enabled
- Requerido: Trained model logged with MLflow (from tracking runs)
- Requerido: Model name for registry registration
- Opcional: Approval workflow integration (email, Slack, Jira)
- Opcional: CI/CD pipeline for automated promotion
- Opcional: Model validation metrics thresholds
Procedimiento
Paso 1: Configure Model Registry Backend
Set up MLflow Model Registry with database backend (file-based registry not recommended for production).
# Start MLflow server with Model Registry support
mlflow server \
--backend-store-uri postgresql://user:pass@localhost:5432/mlflow \
--default-artifact-root s3://mlflow-artifacts/models \
--host 0.0.0.0 \
--port 5000
Python configuration:
# model_registry_config.py
import mlflow
from mlflow.tracking import MlflowClient
# Set tracking URI (must support Model Registry)
MLFLOW_TRACKING_URI = "http://mlflow-server.company.com:5000"
mlflow.set_tracking_uri(MLFLOW_TRACKING_URI)
# ... (see EXAMPLES.md for complete implementation)
Esperado: Model Registry UI tab appears in MLflow, search_registered_models() returns successfully (even if empty), database contains registered_models table.
En caso de fallo: Verify MLflow version ≥1.2 (Model Registry introduced in 1.2), check database backend (SQLite not fully supported for Model Registry), ensure --backend-store-uri points to database (not file://), verify database user has CREATE TABLE permissions, check MLflow server logs for migration errors.
Paso 2: Register Model from Training Run
Register a logged model to the Model Registry with comprehensive metadata.
# register_model.py
import mlflow
from mlflow.tracking import MlflowClient
from model_registry_config import MLFLOW_TRACKING_URI
mlflow.set_tracking_uri(MLFLOW_TRACKING_URI)
client = MlflowClient()
# ... (see EXAMPLES.md for complete implementation)
Esperado: New model version appears in Model Registry UI, version includes description and tags, model artifacts are accessible via models:/<model-name>/<version> URI, model signature and input example are preserved.
En caso de fallo: Verify run_id exists and has completed (client.get_run(run_id)), check model artifact path matches logged artifact (mlflow.search_runs() to inspect), ensure model was logged with proper framework flavor (mlflow.sklearn.log_model not mlflow.log_artifact), verify no special characters in model name (use hyphens not underscores), check artifact storage accessibility.
Paso 3: Implement Stage Transitions with Validation
Move model versions through stages (None → Staging → Production → Archived) with validation checks.
# stage_management.py
import mlflow
from mlflow.tracking import MlflowClient
from datetime import datetime
client = MlflowClient()
class ModelStageManager:
# ... (see EXAMPLES.md for complete implementation)
Esperado: Model version stage updates in registry, old versions archived automatically, transition timestamps recorded in tags, rollback restores previous production version.
En caso de fallo: Check version exists and is in expected stage, verify archive_existing_versions flag behavior (may not archive if only one version), ensure database supports concurrent transactions for stage updates, check for stage transition locks (only one transition per version at a time), verify approval workflow integration.
Paso 4: Implement Model Aliasing and References
Use model aliases for stable deployment references (MLflow ≥2.0).
# model_aliases.py
from mlflow.tracking import MlflowClient
client = MlflowClient()
def set_model_alias(model_name, version, alias):
"""
Set an alias for a model version (MLflow 2.0+).
# ... (see EXAMPLES.md for complete implementation)
Esperado: Aliases appear in Model Registry UI, loading models by alias works (models:/name@alias), updating alias immediately affects new loads, A/B test infrastructure functional.
En caso de fallo: Upgrade MLflow to ≥2.0 for native alias support, use tag-based fallback for older versions, verify alias naming (alphanumeric and hyphens only), check for alias conflicts (one alias per model version).
Paso 5: Implement Model Lineage Tracking
Track full lineage from data to deployment with comprehensive metadata.
# model_lineage.py
import mlflow
from mlflow.tracking import MlflowClient
import json
client = MlflowClient()
def enrich_model_metadata(model_name, version, lineage_data):
# ... (see EXAMPLES.md for complete implementation)
Esperado: Model version tags include comprehensive lineage information, get_model_lineage() returns full history, JSON report contains data source, training details, and deployment info.
En caso de fallo: Verify tag values are strings (convert dicts to JSON), check tag key naming (no spaces or special chars), ensure lineage data captured during training, verify run_id is valid and accessible.
Paso 6: Automate Registry Operations with CI/CD
Integrate model registration into CI/CD pipelines for automated promotion.
# .github/workflows/model_promotion.yml
name: Model Promotion Pipeline
on:
workflow_dispatch:
inputs:
model_name:
description: 'Model name to promote'
# ... (see EXAMPLES.md for complete implementation)
Python automation script:
# scripts/promote_model.py
import argparse
from stage_management import ModelStageManager
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--model-name", required=True)
parser.add_argument("--version", type=int, required=True)
# ... (see EXAMPLES.md for complete implementation)
Esperado: GitHub Actions workflow triggers on manual dispatch, validation tests pass, model promoted to target stage, Slack notification sent, deployment pipeline triggered automatically.
En caso de fallo: Check GitHub secrets configuration for MLFLOW_TRACKING_URI, verify network access from GitHub Actions to MLflow server (may need VPN or IP allowlist), ensure validation script has correct metric thresholds, check Slack webhook configuration, verify Python script executable permissions.
Validación
- Model Registry accessible and backend configured
- Models register successfully from training runs
- Stage transitions work (None → Staging → Production → Archived)
- Validation checks enforce quality thresholds
- Model aliases set and resolved correctly
- Lineage metadata captured comprehensively
- Rollback functionality restores previous versions
- CI/CD pipeline automates promotions
- Team notifications working for stage changes
- Model URIs resolve correctly in all stages
Errores Comunes
- SQLite limitations: Model Registry requires database backend (PostgreSQL/MySQL) for production - file-based registry causes concurrency issues
- Stage conflicts: Multiple versions in same stage cause confusion - use
archive_existing_versions=Trueto auto-archive - Missing run linkage: Registering models without run_id loses lineage - always register from MLflow runs, not raw files
- Alias confusion: Using stages as deployment targets instead of aliases - stages are for workflow, aliases for deployment references
- Validation skipped: Promoting to Production without checks - implement mandatory validation in CI/CD pipeline
- No rollback plan: Production issues without rollback capability - maintain previous Production version in Archived stage
- Tag overload: Too many unstructured tags - standardize tag schema and naming conventions
- Manual processes: Human-driven promotions are error-prone and slow - automate with CI/CD and approval workflows
- Lost artifacts: Model registered but artifacts deleted from storage - ensure artifact retention policies align with model lifecycle
Habilidades Relacionadas
track-ml-experiments- Log models to MLflow before registering themdeploy-ml-model-serving- Deploy registered models to serving infrastructurerun-ab-test-models- A/B test models using registry aliasesorchestrate-ml-pipeline- Automate model training and registrationversion-ml-data- Version training data for model lineage
GitHub Repository
Related Skills
qmd
Developmentqmd is a local search and indexing CLI tool that enables developers to index and search through local files using hybrid search combining BM25, vector embeddings, and reranking. It supports both command-line usage and MCP (Model Context Protocol) mode for integration with Claude. The tool uses Ollama for embeddings and stores indexes locally, making it ideal for searching documentation or codebases directly from the terminal.
subagent-driven-development
DevelopmentThis skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.
mcporter
DevelopmentThe mcporter skill enables developers to manage and call Model Context Protocol (MCP) servers directly from Claude. It provides commands to list available servers, call their tools with arguments, and handle authentication and daemon lifecycle. Use this skill for integrating and testing MCP server functionality in your development workflow.
adk-deployment-specialist
DevelopmentThis skill deploys and orchestrates Vertex AI ADK agents using A2A protocol, managing AgentCard discovery, task submission, and supporting tools like Code Execution Sandbox and Memory Bank. It enables building multi-agent systems with sequential, parallel, or loop orchestration patterns in Python, Java, or Go. Use it when asked to deploy ADK agents or orchestrate agent workflows on Google Cloud.
