This page describes automations in W&B. Create an automation to trigger workflow steps, such as automated model testing and deployment, based on an event in W&B, such as when an artifact artifact version is created or when a run metric meets or changes by a threshold.
For example, an automation can notify a Slack channel when a new version is created, trigger an automated testing webhook when the production alias is added to an artifact, or start a validation job only when a run’s loss is within acceptable bounds.
Overview
An automation can start when a specific event occurs in a registry or project.
For an artifact in a Registry, an automation can start:
When a new artifact version is linked to a collection. For example, trigger testing and validation workflows for new candidate models.
When an alias is added to an artifact version. For example, trigger a deployment workflow when an alias is added to a model version.
For an artifact in a project, an automation can start:
When a new version is added to an artifact. For example, start a training job when a new version of a dataset artifact is added to a given collection.
When an alias is added to an artifact version. For example, trigger a PII redaction workflow when the alias “redaction” is added to a dataset artifact.
When a metric for a run meets or exceeds a configured threshold.
When a metric for a run changes by a configured threshold.
This diagram shows the relationship between automation events and actions.
If required, configure secrets for sensitive strings the automation requires, such as access tokens, passwords, or sensitive configuration details. Secrets are defined in your Team Settings. Secrets are most commonly used in webhook automations to securely pass credentials or tokens to the webhook’s external service without exposing it in plain text or hard-coding it in the webhook’s payload.
Configure the webhook or Slack notification to authorize W&B to post to Slack or run the webhook on your behalf. A single automation action (webhook or Slack notification) can be used by multiple automations. These actions are defined in your Team Settings.
In the project or registry, create the automation:
Define the event to watch for, such as when a new artifact version is added.
Define the action to take when the event occurs (posting to a Slack channel or running a webhook). For a webhook, specify a secret to use for the access token and/or a secret to send with the payload, if required.
A team admin can create and manage automations for the team’s projects, as well as components of their automations, such as webhooks, secrets, and Slack integrations. Refer to Team settings.
To create a registry automation, you must have access to the registry. Refer to Configure Registry access.
To create a Slack automation, you must have permission to post to the Slack instance and channel you select.
Create an automation
Create an automation from the project or registry’s Automations tab. At a high level, to create an automation, follow these steps:
If necessary, create a W&B secret for each sensitive string required by the automation, such as an access token, password, or SSH key. Secrets are defined in your Team Settings. Secrets are most commonly used in webhook automations.
Configure the webhook or Slack integration to authorize W&B to post to Slack or run the webhook on your behalf. A single webhook or Slack integration can be used by multiple automations. These actions are defined in your Team Settings.
In the project or registry, create the automation, which specifies the event to watch for and the action to take (such as posting to Slack or running a webhook). When you create a webhook automation, you configure the payload it sends.
Or, from a line plot in the workspace, you can quickly create a run metric automation for the metric it shows:
Hover over the panel, then click the bell icon at the top of the panel.
Configure the automation using the basic or advanced configuration controls. For example, apply a run filter to limit the scope of the automation, or configure an absolute threshold.
A team admin can add a Slack integration to the team.
Log in to W&B and go to Team Settings.
In the Slack channel integrations section, click Connect Slack to add a new Slack instance. To add a channel for an existing Slack instance, click New integration.
If necessary, sign in to Slack in your browser. When prompted, grant W&B permission to post to the Slack channel you select. Read the page, then click Search for a channel and begin typing the channel name. Select the channel from the list, then click Allow.
In Slack, go to the channel you selected. If you see a post like [Your Slack handle] added an integration to this channel: Weights & Biases, the integration is configured correctly.
Now you can create an automation that notifies the Slack channel you configured.
View and manage Slack integrations
A team admin can view and manage the team’s Slack instances and channels.
Log in to W&B and go to Team Settings.
View each Slack destination in the Slack channel integrations section.
Delete a destination by clicking its trash icon.
Create an automation
After you add a Slack integration, select Registry or Project, then follow these steps to create an automation that notifies the Slack channel.
A Registry admin can create automations in that registry.
Log in to W&B.
Click the name of a registry to view its details,
To create an automation scoped to the registry, click the Automations tab, then click Create automation. An automation that is scoped to a registry is automatically applied to all of its collections (including those created in the future).
To create an automation scoped only to a specific collection in the registry, click the collection’s action ... menu, then click Create automation. Alternatively, while viewing a collection, create an automation for it using the Create automation button in the Automations section of the collection’s details page.
Fill in any additional fields that appear, which depend upon the event. For example, if you select An artifact alias is added, you must specify the Alias regex.
Set Action type to Slack notification. Select the Slack channel, then click Next step.
Provide a name for the automation. Optionally, provide a description.
Click Create automation.
A W&B admin can create automations in a project.
Log in to W&B.
Go the project page and click the Automations tab, then click Create automation.
Or, from a line plot in the workspace, you can quickly create a run metric automation for the metric it shows. Hover over the panel, then click the bell icon at the top of the panel.
Fill in any additional fields that appear, which depend upon the event. For example, if you select An artifact alias is added, you must specify the Alias regex.
At a high level, to create a webhook automation, you take these steps:
If necessary, create a W&B secret for each sensitive string required by the automation, such as an access token, password, or SSH key. Secrets are defined in your Team Settings.
Create a webhook to define the endpoint and authorization details and grant the integration access to any secrets it needs.
Create the automation to define the event to watch for and the payload W&B will send. Grant the automation access to any secrets it needs for the payload.
Create a webhook
A team admin can add a webhook for the team.
If the webhook requires a Bearer token or its payload requires a sensitive string, create a secret that contains it before creating the webhook. You can configure at most one access token and one other secret for a webhook. Your webhook’s authentication and authorization requirements are determined by the webhook’s service.
Log in to W&B and go to Team Settings page.
In the Webhooks section, click New webhook.
Provide a name for the webhook.
Provide the endpoint URL for the webhook.
If the webhook requires a Bearer token, set Access token to the secret that contains it. When using the webhook automation, W&B sets the Authorization: Bearer HTTP header to the access token, and you can access the token in the ${ACCESS_TOKEN}payload variable. Learn more about the structure of the POST request W&B sends to the webhook service in Troubleshoot your webhook.
If the webhook requires a password or other sensitive string in its payload, set Secret to the secret that contains it. When you configure the automation that uses the webhook, you can access the secret as a payload variable by prefixing its name with $.
If the webhook’s access token is stored in a secret, you must also complete the next step to specify the secret as the access token.
To verify that the W&B can connect and authenticate to the endpoint:
Optionally, provide a payload to test. To refer to a secret the webhook has access to in the payload, prefix its name with $. This payload is only used for testing and is not saved. You configure an automation’s payload when you create the automation. See Troubleshoot your webhook to view where the secret and access token are specified in the POST request.
Click Test. W&B attempts to connect to the webhook’s endpoint using the credentials you configured. If you provided a payload, W&B sends it.
If the test does not succeed, verify the webhook’s configuration and try again. If necessary, refer to Troubleshoot your webhook.
After you configure a webhook, select Registry or Project, then follow these steps to create an automation that triggers the webhook.
A Registry admin can create automations in that registry. Registry automations are applied to all collections in the registry, including those added in the future.
Log in to W&B.
Click the name of a registry to view its details,
To create an automation scoped to the registry, click the Automations tab, then click Create automation. An automation that is scoped to a registry is automatically applied to all of its collections (including those created in the future).
To create an automation scoped only to a specific collection in the registry, click the collection’s action ... menu, then click Create automation. Alternatively, while viewing a collection, create an automation for it using the Create automation button in the Automations section of the collection’s details page.
Choose the event to watch for. Fill in any additional fields that appear, which depend upon the event. For example, if you select An artifact alias is added, you must specify the Alias regex. Click Next step.
Set Action type to Webhooks. then select the webhook to use.
If you configured an access token for the webhook, you can access the token in the ${ACCESS_TOKEN}payload variable. If you configured a secret for the webhook, you can access it in the payload by prefixing its name with $. Your webhook’s requirements are determined by the webhook’s service.
Click Next step.
Provide a name for the automation. Optionally, provide a description. Click Create automation.
A W&B admin can create automations in a project.
Log in to W&B and go to the project page.
In the sidebar, click Automations, then click Create automation.
Or, from a line plot in the workspace, you can quickly create a run metric automation for the metric it shows. Hover over the panel, then click the bell icon at the top of the panel.
Choose the event to watch for, such as when an artifact alias is added or when a run metric meets a given threshold.
Fill in any additional fields that appear, which depend upon the event. For example, if you select An artifact alias is added, you must specify the Alias regex.
Optionally specify a collection filter. Otherwise, the automation is applied to all collections in the project, including those added in the future.
Set Action type to Webhooks. then select the webhook to use.
If your webhook requires a payload, construct it and paste it into the Payload field. If you configured an access token for the webhook, you can access the token in the ${ACCESS_TOKEN}payload variable. If you configured a secret for the webhook, you can access it in the payload by prefixing its name with $. Your webhook’s requirements are determined by the webhook’s service.
Click Next step.
Provide a name for the automation. Optionally, provide a description. Click Create automation.
View and manage automations
Manage a registry’s automations from the registry’s Automations tab.
Manage a collection’s automations from the Automations section of the collection’s details page.
From either of these pages, a Registry admin can manage existing automations:
To view an automation’s details, click its name.
To edit an automation, click its action ... menu, then click Edit automation.
To delete an automation, click its action ... menu, then click Delete automation. Confirmation is required.
A W&B admin can view and manage a project’s automations from the project’s Automations tab.
To view an automation’s details, click its name.
To edit an automation, click its action ... menu, then click Edit automation.
To delete an automation, click its action ... menu, then click Delete automation. Confirmation is required.
Payload reference
Use these sections to construct your webhoook’s payload. For details about testing your webhook and its payload, refer to Troubleshoot your webhook.
Payload variables
This section describes the variables you can use to construct your webhook’s payload.
Variable
Details
${project_name}
The name of the project that owns the mutation that triggered the action.
${entity_name}
The name of the entity or team that owns the mutation that triggered the action.
${event_type}
The type of event that triggered the action.
${event_author}
The user that triggered the action.
${artifact_collection_name}
The name of the artifact collection that the artifact version is linked to.
${artifact_metadata.<KEY>}
The value of an arbitrary top-level metadata key from the artifact version that triggered the action. Replace <KEY> with the name of a top-level metadata key. Only top-level metadata keys are available in the webhook’s payload.
${artifact_version}
The Wandb.Artifact representation of the artifact version that triggered the action.
${artifact_version_string}
The string representation of the artifact version that triggered the action.
${ACCESS_TOKEN}
The value of the access token configured in the webhook, if an access token is configured. The access token is automatically passed in the Authorization: Bearer HTTP header.
${SECRET_NAME}
If configured, the value of a secret configured in the webhook. Replace SECRET_NAME with the name of the secret.
Payload examples
This section includes examples of webhook payloads for some common use cases. The examples demonstrate how to use payload variables.
Verify that your access tokens have required set of permissions to trigger your GHA workflow. For more information, see these GitHub Docs.
Send a repository dispatch from W&B to trigger a GitHub action. For example, suppose you have a GitHub workflow file that accepts a repository dispatch as a trigger for the on key:
on:
repository_dispatch:
types: BUILD_AND_DEPLOY
The payload for the repository might look something like:
The event_type key in the webhook payload must match the types field in the GitHub workflow YAML file.
The contents and positioning of rendered template strings depends on the event or model version the automation is configured for. ${event_type} will render as either LINK_ARTIFACT or ADD_ARTIFACT_ALIAS. See below for an example mapping:
Use template strings to dynamically pass context from W&B to GitHub Actions and other tools. If those tools can call Python scripts, they can consume the registered model artifacts through the W&B API.
Review a W&B report, which illustrates how to use a Github Actions webhook automation for Model CI. Check out this GitHub repository to learn how to create model CI with a Modal Labs webhook.
This example payload shows how to notify your Teams channel using a webhook:
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"summary": "New Notification",
"sections": [
{
"activityTitle": "Notification from WANDB",
"text": "This is an example message sent via Teams webhook.",
"facts": [
{
"name": "Author",
"value": "${event_author}" },
{
"name": "Event Type",
"value": "${event_type}" }
],
"markdown": true }
]
}
You can use template strings to inject W&B data into your payload at the time of execution (as shown in the Teams example above).
This section is provided for historical purposes. If you currently use a webhook to integrate with Slack, W&B recommends that you update your configuration to use the [new Slack integration]({{ relref “#create-a-slack-automation”}}) instead.
Set up your Slack app and add an incoming webhook integration with the instructions highlighted in the Slack API documentation. Ensure that you have the secret specified under Bot User OAuth Token as your W&B webhook’s access token.
Interactively troubleshoot your webhook with the W&B App UI or programmatically with a Bash script. You can troubleshoot a webhook when you create a new webhook or edit an existing webhook.
For details about the format W&B uses for the POST request, refer to the Bash script tab.
A team admin can test a webhook interactively with the W&B App UI.
Navigate to your W&B Team Settings page.
Scroll to the Webhooks section.
Click on the horizontal three docs (meatball icon) next to the name of your webhook.
Select Test.
From the UI panel that appears, paste your POST request to the field that appears.
Click on Test webhook. Within the W&B App UI, W&B posts the response from your endpoint.
An automation can start when a specific event occurs within a project or registry. This diagram shows the relationship between automation events and actions.
This page describes the events that can trigger an automation within each scope. Learn more about automations in the Automations overview or Create an automation.
Registry
This section describes the scopes and events for an automation in a Registry.
You can create a Registry automation at these scopes:
Registry level: The automation watches for the event taking place on any collection within a specific registry, including collections added in the future.
Collection level: A single collection in a specific registry.
Events
A Registry automation can watch for these events:
Linking a new artifact to a collection: Test and validate new models or datasets when they are added to a registry.
Adding a new alias to a version of an artifact: Trigger a specific step of your workflow when a new artifact version has a specific alias applied. For example, deploy a model when it has the production alias applied.
Project
This section describes the scopes and events for an automation in a project.
Navigate to your W&B project on the W&B App at https://wandb.ai/<team>/<project-name>.
View and create automations in the Automations tab.
You can create a project automation at these scopes:
Project level: The automation watches for the event taking place on any collection in the project.
Collection level: All collections in the project that match the filter you specify.
Artifact events
This section describes the events related to an artifact that can trigger an automation.
Linking a new artifact: Test and validate new models or datasets automatically.
Creating a new version of an artifact: Apply recurring actions to each version of an artifact. For example, start a training job when a new dataset artifact version is created.
Adding a new alias to a version of an artifact: Trigger a specific step of your workflow when a new artifact version in a project or collection has a specific label or alias applied. For example, run a series of downstream processing steps when an artifact has the test-set-quality-check alias applied.
Run events
From the project’s Automations tab or directly from a line plot panel, you can create a run metric automation triggered by:
A metric in a run’s history.
A system metric such as cpu, which tracks the percentage of CPU utilization. W&B logs system metrics automatically every 15 seconds.
The notification can watch the metric for these events:
Run metrics threshold met: Trigger a workflow when for a given metric, a single logged value or the average logged values meets the threshold you specify.
Run metrics change threshold met: Trigger a workflow when the average logged values of a run change by the absolute or relative threshold you specify.
To set up a run metric automation, you configure how to compare the metric’s value with the threshold you specify. Your choices depend on the event type and on any filters you specify.