LogoLogo
ProductResourcesGitHubStart free
  • Documentation
  • Learn
  • ZenML Pro
  • Stacks
  • API Reference
  • SDK Reference
  • Overview
  • Integrations
  • Stack Components
    • Orchestrators
      • Local Orchestrator
      • Local Docker Orchestrator
      • Kubeflow Orchestrator
      • Kubernetes Orchestrator
      • Google Cloud VertexAI Orchestrator
      • AWS Sagemaker Orchestrator
      • AzureML Orchestrator
      • Databricks Orchestrator
      • Tekton Orchestrator
      • Airflow Orchestrator
      • Skypilot VM Orchestrator
      • HyperAI Orchestrator
      • Lightning AI Orchestrator
      • Develop a custom orchestrator
    • Artifact Stores
      • Local Artifact Store
      • Amazon Simple Cloud Storage (S3)
      • Google Cloud Storage (GCS)
      • Azure Blob Storage
      • Develop a custom artifact store
    • Container Registries
      • Default Container Registry
      • DockerHub
      • Amazon Elastic Container Registry (ECR)
      • Google Cloud Container Registry
      • Azure Container Registry
      • GitHub Container Registry
      • Develop a custom container registry
    • Step Operators
      • Amazon SageMaker
      • AzureML
      • Google Cloud VertexAI
      • Kubernetes
      • Modal
      • Spark
      • Develop a Custom Step Operator
    • Experiment Trackers
      • Comet
      • MLflow
      • Neptune
      • Weights & Biases
      • Google Cloud VertexAI Experiment Tracker
      • Develop a custom experiment tracker
    • Image Builders
      • Local Image Builder
      • Kaniko Image Builder
      • AWS Image Builder
      • Google Cloud Image Builder
      • Develop a Custom Image Builder
    • Alerters
      • Discord Alerter
      • Slack Alerter
      • Develop a Custom Alerter
    • Annotators
      • Argilla
      • Label Studio
      • Pigeon
      • Prodigy
      • Develop a Custom Annotator
    • Data Validators
      • Great Expectations
      • Deepchecks
      • Evidently
      • Whylogs
      • Develop a custom data validator
    • Feature Stores
      • Feast
      • Develop a Custom Feature Store
    • Model Deployers
      • MLflow
      • Seldon
      • BentoML
      • Hugging Face
      • Databricks
      • vLLM
      • Develop a Custom Model Deployer
    • Model Registries
      • MLflow Model Registry
      • Develop a Custom Model Registry
  • Service Connectors
    • Introduction
    • Complete guide
    • Best practices
    • Connector Types
      • Docker Service Connector
      • Kubernetes Service Connector
      • AWS Service Connector
      • GCP Service Connector
      • Azure Service Connector
      • HyperAI Service Connector
  • Popular Stacks
    • AWS
    • Azure
    • GCP
    • Kubernetes
  • Deployment
    • 1-click Deployment
    • Terraform Modules
    • Register a cloud stack
    • Infrastructure as code
  • Contribute
    • Custom Stack Component
    • Custom Integration
Powered by GitBook
On this page
  • Alerter Flavors
  • How to use Alerters with ZenML
  • Using the Ask Step for Human-in-the-Loop Workflows
  • How Ask Steps Work
  • Default Response Keywords
  • Customizing Response Keywords
  • Important Notes

Was this helpful?

Edit on GitHub
  1. Stack Components

Alerters

Sending automated alerts to chat services.

PreviousDevelop a Custom Image BuilderNextDiscord Alerter

Last updated 17 days ago

Was this helpful?

Alerters allow you to send messages to chat services (like Slack, Discord, Mattermost, etc.) from within your pipelines. This is useful to immediately get notified when failures happen, for general monitoring/reporting, and also for building human-in-the-loop ML.

Alerter Flavors

Currently, the and are the available alerter integrations. However, it is straightforward to extend ZenML and .

Alerter
Flavor
Integration
Notes

slack

slack

Interacts with a Slack channel

discord

discord

Interacts with a Discord channel

custom

Extend the alerter abstraction and provide your own implementation

If you would like to see the available flavors of alerters in your terminal, you can use the following command:

zenml alerter flavor list

How to use Alerters with ZenML

Each alerter integration comes with specific standard steps that you can use out of the box.

However, you first need to register an alerter component in your terminal:

zenml alerter register <ALERTER_NAME> ...

Then you can add it to your stack using

zenml stack register ... -al <ALERTER_NAME>

Afterward, you can import the alerter standard steps provided by the respective integration and directly use them in your pipelines.

Using the Ask Step for Human-in-the-Loop Workflows

All alerters provide an ask() method and corresponding ask steps that enable human-in-the-loop workflows. These are essential for:

  • Getting approval before deploying models to production

  • Confirming critical pipeline decisions

  • Manual intervention points in automated workflows

How Ask Steps Work

Ask steps (like discord_alerter_ask_step and slack_alerter_ask_step):

  1. Post a message to your chat service with your question

  2. Wait for user response containing specific approval or disapproval keywords

  3. Return a boolean - True if approved, False if disapproved or timeout

from zenml import step, pipeline
from zenml.integrations.slack.steps.slack_alerter_ask_step import slack_alerter_ask_step

@step
def deploy_model(model, approved: bool) -> None:
    if approved:
        # Deploy the model to production
        print("Deploying model to production...")
        # deployment logic here
    else:
        print("Deployment cancelled by user")

@pipeline
def deployment_pipeline():
    trained_model = train_model()
    # Ask for human approval before deployment
    approved = slack_alerter_ask_step("Deploy model to production?")
    deploy_model(trained_model, approved)

Default Response Keywords

By default, alerters recognize these response options:

Approval: approve, LGTM, ok, yes Disapproval: decline, disapprove, no, reject

Customizing Response Keywords

You can customize the approval and disapproval keywords using alerter parameters:

from zenml.integrations.slack.steps.slack_alerter_ask_step import slack_alerter_ask_step
from zenml.integrations.slack.alerters.slack_alerter import SlackAlerterParameters

# Use custom approval/disapproval keywords
params = SlackAlerterParameters(
    approve_msg_options=["deploy", "ship it", "✅"],
    disapprove_msg_options=["stop", "cancel", "❌"]
)

approved = slack_alerter_ask_step(
    "Deploy model to production?", 
    params=params
)

Important Notes

  • Return Type: Ask steps return a boolean value - ensure your pipeline logic handles this correctly

  • Keywords: Response keywords are case-sensitive (except Slack, which converts to lowercase)

  • Timeout: If no valid response is received within the timeout period, the step returns False

  • Permissions: Ensure your bot has permissions to read messages in the target channel

SlackAlerter
DiscordAlerter
build an alerter for other chat services
Slack
Discord
Custom Implementation
ZenML Scarf