Automating Machine Learning Pipelines with doushi-cli in CI/CD
How to use the official doushi-cli Python package to train, evaluate, and update production machine learning models headless from GitHub Actions.
Direct Answer / TL;DR: The official Python package
doushi-cli(available on PyPI viapip install doushi-cli) allows engineers to trigger autonomous machine learning pipelines directly from terminal scripts, bash files, and CI/CD workflows. You can train new models headless (doushi train data.csv --goal "predict churn"), execute batch predictions (doushi predict), and deploy production updates automatically whenever new data lands in cloud storage.
While Doushi's web application provides an intuitive visual UI and live simulator for product teams, engineering organizations often require headless automation.
Whenever data warehouses (Snowflake, BigQuery, PostgreSQL) export refreshed monthly datasets, models should be automatically retrained, validated against performance thresholds, and rolled out without manual human intervention.
Here is how to set up autonomous continuous retraining using doushi-cli and GitHub Actions.
Installation & CLI Setup
doushi-cli is published on PyPI and requires Python 3.9+:
# Standard pip installation
pip install doushi-cli
Verify the installation:
doushi --version
# Output: doushi-cli v1.0.4
# or use equivalent alias:
dsh --version
To configure your authentication credentials, create an API key at https://app.doushi.ai and paste it using:
doushi configure
Core CLI Commands
1. Interactive Demo Mode
Test the platform capabilities immediately using our built-in churn or housing valuation benchmark datasets:
doushi demo
2. Headless Model Training
Submit a training job directly from your local file system or pipeline script:
doushi train \
"./data/q3_churn_records.csv" \
--goal "Predict churn. Maximize recall for high-value accounts while keeping precision > 80%"
The CLI streams live training progress from the Frankfurt Serverless Fargate sandbox:
[INFO] Uploading dataset 'q3_churn_records.csv' (12.4 MB)... Complete.
[INFO] Starting ephemeral sandbox (task: dsh-sbx-9812)...
[INFO] Running automated data cleaning & categorical encoding...
[INFO] Tournament: Evaluating LightGBM, XGBoost, CatBoost...
[SUCCESS] Champion model identified: LightGBM (ROC-AUC: 0.934)
......
3. Local Batch Prediction
Score a new batch of 50,000 incoming leads (maximum payload is 10 MB per batch) or customer records:
doushi predict sample-project-id-123 \
--file ./data/new_leads.csv \
--output ./predictions.csv
4. Code & Artifact Export
Download the complete, transparent Python training code and model weights:
doushi export sample-project-id-123 --out ./exported_pipeline/
Setting Up GitHub Actions for Continuous Retraining
Here is a complete .github/workflows/retrain_model.yml configuration that runs on a schedule or whenever a data commit occurs:
name: Continuous ML Retraining Pipeline
on:
schedule:
# Run at midnight every Sunday
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
retrain-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install doushi-cli
run: pip install doushi-cli
- name: Fetch Latest Dataset
run: |
# Fetch fresh dataset from S3 / data lake
echo "Syncing data from warehouse..."
# aws s3 cp s3://company-warehouse/latest_customers.csv ./data.csv
- name: Run Doushi Training
env:
DOUSHI_API_KEY: ${{ secrets.DOUSHI_API_KEY }}
run: |
doushi train \
"./data/q3_churn_records.csv" \
--goal "Predict churn. Maximize recall for high-value accounts while keeping precision > 80%" \
--json ./build_result.json
- name: Verify Quality Gate
run: |
python -c "
import json, sys
with open('./build_result.json') as f:
res = json.load(f)
auc = res.get('metrics', {}).get('roc_auc', 0)
print(f'Champion ROC-AUC: {auc}')
if auc < 0.88:
print('Quality gate failed: ROC-AUC below 0.88!')
sys.exit(1)
print('Quality gate passed!')
"
Summary
With doushi-cli, your team bridges the gap between self-service AI for business teams and automated DevOps best practices for software engineers.
Check out the full CLI Documentation and visit the doushi-cli GitHub repository.
