Skip to main content
The W&B Automations API enables programmatic creation and management of automated workflows that respond to events in your ML pipeline. Configure actions to trigger when specific conditions are met, such as model performance thresholds or artifact creation.

Core Classes

ClassDescription
AutomationRepresents a saved automation instance with its configuration.
NewAutomationBuilder class for creating new automations.

Events (Triggers)

EventDescription
OnRunMetricTrigger when a run metric satisfies a defined condition (threshold, change, etc.).
OnCreateArtifactTrigger when a new artifact is created in a collection.
OnLinkArtifactTrigger when an artifact is linked to a registry.
OnAddArtifactAliasTrigger when an alias is added to an artifact.

Actions

ActionDescription
SendNotificationSend notifications via Slack or other integrated channels.
SendWebhookSend HTTP webhook requests to external services.
DoNothingPlaceholder action for testing automation configurations.

Filters

FilterDescription
MetricThresholdFilterFilter runs based on metric value comparisons against thresholds.
MetricChangeFilterFilter runs based on metric value changes over time.

Common Use Cases

Model Performance Monitoring

  • Alert when model accuracy drops below a threshold
  • Notify team when training loss plateaus
  • Trigger retraining pipelines based on performance metrics

Artifact Management

  • Send notifications when new model versions are created
  • Trigger deployment workflows when artifacts are tagged
  • Automate downstream processing when datasets are updated

Experiment Tracking

  • Alert on failed or crashed runs
  • Notify when long-running experiments complete
  • Send daily summaries of experiment metrics

Integration Workflows

  • Update external tracking systems via webhooks
  • Sync model registry with deployment platforms
  • Trigger CI/CD pipelines based on W&B events

Example Usage

The following example creates an automation that sends a Slack notification whenever a metric called custom-metric exceeds 10. custom-metric is expected to be logged during training using wandb.Run.log({"custom-metric": value }).
import wandb
from wandb.automations import OnRunMetric, RunEvent, SendNotification

api = wandb.Api()

project = api.project("<my-project>", entity="<my-team>")

# Use the first Slack integration for the team
slack_hook = next(api.slack_integrations(entity="<my-team>"))

# Create a trigger event
event = OnRunMetric(
     scope=project,
     filter=RunEvent.metric("custom-metric") > 10,
)

# Create an action that responds to the event
action = SendNotification.from_integration(slack_hook)

# Create the automation
automation = api.create_automation(
     event >> action,
     name="my-automation",
     description="Send a Slack message whenever 'custom-metric' exceeds 10.",
)
For more information about using the Automations API, see the Automations Guide.
I