DataRobot MLOps

raw JSON →
11.1.28 verified Fri May 01 auth: no python

Python SDK for DataRobot MLOps to read and report model monitoring statistics (accuracy, drift, data quality) to DataRobot's MLOps platform. Current version 11.1.28, requires Python >=3.9. Released as part of DataRobot's MLOps cloud or on-premise deployment with frequent minor releases.

pip install datarobot-mlops
error AttributeError: module 'datarobot' has no attribute 'mlops'
cause Importing as 'datarobot.mlops' instead of 'datarobot_mlops'.
fix
Use correct import: 'from datarobot_mlops import MLOpsReporting'
error TypeError: MLOpsReporting.__init__() got an unexpected keyword argument 'application_key'
cause datarobot-mlops 11.x removed application_key; use api_token.
fix
Replace application_key='...' with api_token='...'.
error datarobot_mlops.exceptions.MLOpsException: (403) Forbidden
cause Invalid or expired API token, or insufficient permissions on the deployment.
fix
Verify API token and permissions; check server_url and token environment variables.
breaking In version 11.x, MLOpsReporting no longer accepts 'application_key' argument; use 'api_token' instead.
fix Replace 'application_key' with 'api_token' in constructor.
deprecated The method 'report_binary_classification_stats' is deprecated in 10.x+ and removed in 11.x.
fix Use 'report_classification_stats' with 'class_names' parameter instead.
gotcha The SDK uses blocking HTTP calls. In production, run reporting in a separate thread or async task to avoid blocking model inference.
fix Wrap report calls with threading or use an async HTTP client if available (not natively supported).
gotcha Deployment ID must be a string; integer or UUID object will raise AttributeError.
fix Always pass deployment_id as str(deployment_id).

Basic usage to report model predictions and execution time to a DataRobot MLOps deployment.

import os
from datarobot_mlops import MLOpsReporting

# Initialize with API credentials from environment
mlops_report = MLOpsReporting(
    server_url=os.environ.get('DATAROBOT_API_ENDPOINT', ''),
    api_token=os.environ.get('DATAROBOT_API_TOKEN', '')
)

# Report deployment stats
mlops_report.report_deployment_stats(
    deployment_id='your-deployment-id',
    predictions=100,
    execution_time=0.5,
    model_id='your-model-id'
)
print("Stats reported successfully.")