> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-style-guide-models-reports-20260604-104120.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Use tags to organize collections or artifact versions within collections. You can add, remove, edit tags with the Python SDK or W&B UI.

# Organize versions with tags

Tags help you organize and find collections or artifact versions within a registry. Unlike aliases, tags are flexible labels that can be shared across multiple versions or collections, which makes them useful for grouping related items and for search.

This page shows how to add, modify, view, and remove tags on a collection or artifact version using either the W\&B UI or the W\&B Python SDK.

<Note>
  **When to use a tag versus using an alias**

  Use aliases when you need to reference a specific artifact version uniquely. For example, use an alias such as 'production' or 'latest' to ensure that `artifact_name:alias` always points to a single, specific version.

  Use tags when you want more flexibility for grouping or searching. Tags are ideal when multiple versions or collections can share the same label, and you don't need the guarantee that only one version is associated with a specific identifier.
</Note>

## Add a tag to a collection

Use the W\&B UI or Python SDK to add a tag to a collection.

<Tabs>
  <Tab title="W&B UI">
    Use the W\&B UI to add a tag to a collection:

    1. Navigate to the [W\&B Registry](https://wandb.ai/registry).
    2. Click on a registry card.
    3. Click **View details** next to the name of a collection.
    4. Within the collection card, click on the plus icon (**+**) next to the **Tags** field and type in the name of the tag.
    5. Press **Enter** on your keyboard.
  </Tab>

  <Tab title="Python SDK">
    ```python theme={null}
    import wandb

    COLLECTION_TYPE = "[COLLECTION-TYPE]"
    REGISTRY_NAME = "[REGISTRY-NAME]"
    COLLECTION_NAME = "[COLLECTION-NAME]"

    full_name = f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}"

    collection = wandb.Api().artifact_collection(
      type_name = COLLECTION_TYPE, 
      name = full_name
      )

    collection.tags = ["your-tag"]
    collection.save()
    ```
  </Tab>
</Tabs>

## Update tags that belong to a collection

Update a tag programmatically by reassigning the `tags` attribute or mutating it in place. W\&B recommends reassigning the `tags` attribute because it follows Python best practices.

The following code snippet shows common ways to update the list of tags through reassignment. For brevity, it continues the code example from [Add a tag to a collection](#add-a-tag-to-a-collection):

```python theme={null}
collection.tags = [*collection.tags, "new-tag", "other-tag"]
collection.tags = collection.tags + ["new-tag", "other-tag"]

collection.tags = set(collection.tags) - set(tags_to_delete)
collection.tags = []  # deletes all tags
```

The following code snippet shows how you can use in-place mutation to update tags that belong to an artifact version:

```python theme={null}
collection.tags += ["new-tag", "other-tag"]
collection.tags.append("new-tag")

collection.tags.extend(["new-tag", "other-tag"])
collection.tags[:] = ["new-tag", "other-tag"]
collection.tags.remove("existing-tag")
collection.tags.pop()
collection.tags.clear()
```

## View tags that belong to a collection

Use the W\&B UI to view the tags added to a collection.

1. Navigate to the [W\&B Registry](https://wandb.ai/registry).
2. Click on a registry card.
3. Click **View details** next to the name of a collection.

If a collection has one or more tags, you can view those tags within the collection card next to the **Tags** field.

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-style-guide-models-reports-20260604-104120/jYSdnAMvZ5q0Ye3Y/images/registry/tag_collection_selected.png?fit=max&auto=format&n=jYSdnAMvZ5q0Ye3Y&q=85&s=720c7f6b35c34019ccfd776d763bfb77" alt="Registry collection with selected tags" width="2706" height="1904" data-path="images/registry/tag_collection_selected.png" />
</Frame>

Tags added to a collection also appear next to the name of that collection.

For example, in the following image, a tag called "sample-tag-1" was added to the "zoo-dataset-tensors-split" collection.

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-style-guide-models-reports-20260604-104120/jYSdnAMvZ5q0Ye3Y/images/registry/tag_collection.png?fit=max&auto=format&n=jYSdnAMvZ5q0Ye3Y&q=85&s=503eb3afda83ca52544cae2d35bc4fff" alt="Tag management" width="2706" height="1598" data-path="images/registry/tag_collection.png" />
</Frame>

## Remove a tag from a collection

Use the W\&B UI to remove a tag from a collection.

1. Navigate to the [W\&B Registry](https://wandb.ai/registry).
2. Click on a registry card.
3. Click **View details** next to the name of a collection.
4. Within the collection card, hover your mouse over the name of the tag you want to remove.
5. Click on the cancel button (**X** icon).

## Add a tag to an artifact version

You can also tag individual artifact versions within a collection. Add a tag to an artifact version that is linked to a collection with the W\&B UI or with the Python SDK.

<Tabs>
  <Tab title="W&B UI">
    Use the W\&B UI to add a tag to an artifact version:

    1. Navigate to the [W\&B Registry](https://wandb.ai/registry).
    2. Click on a registry card.
    3. Click **View details** next to the name of the collection you want to add a tag to.
    4. Scroll down to **Versions**.
    5. Click **View** next to an artifact version.
    6. Within the **Version** tab, click on the plus icon (**+**) next to the **Tags** field and type in the name of the tag.
    7. Press **Enter** on your keyboard.
  </Tab>

  <Tab title="Python SDK">
    Fetch the artifact version you want to add or update a tag on. After you have the artifact version, access the artifact object's `tags` attribute to add or modify tags on that artifact. Pass in one or more tags as a list to the artifact's `tags` attribute.

    Like other artifacts, you can fetch an artifact from W\&B without creating a run, or you can create a run and fetch the artifact within that run. In either case, call the artifact object's `save` method to update the artifact on the W\&B servers.

    Copy and paste one of the following code cells to add or modify an artifact version's tag. Replace the bracketed placeholders with your own values.

    The following code snippet shows how to fetch an artifact and add a tag without creating a new run:

    ```python title="Add a tag to an artifact version without creating a new run" theme={null}
    import wandb

    ARTIFACT_TYPE = "[TYPE]"
    REGISTRY_NAME = "[REGISTRY-NAME]"
    COLLECTION_NAME = "[COLLECTION-NAME]"
    VERSION = "[ARTIFACT-VERSION]"

    artifact_name = f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}"

    artifact = wandb.Api().artifact(name = artifact_name, type = ARTIFACT_TYPE)
    artifact.tags = ["tag2"] # Provide one or more tags in a list
    artifact.save()
    ```

    The following code snippet shows how to fetch an artifact and add a tag by creating a new run:

    ```python title="Add a tag to an artifact version during a run" theme={null}
    import wandb

    REGISTRY_NAME = "[REGISTRY-NAME]"
    COLLECTION_NAME = "[COLLECTION-NAME]"
    VERSION = "[ARTIFACT-VERSION]"

    with wandb.init(entity = "[ENTITY]", project="[PROJECT]") as run:

        artifact_name = f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}"

        artifact = run.use_artifact(artifact_or_name = artifact_name)
        artifact.tags = ["tag2"] # Provide one or more tags in a list
        artifact.save()
    ```
  </Tab>
</Tabs>

## Update tags that belong to an artifact version

When you need to change the tags on an existing artifact version, you can update them programmatically by either reassigning or mutating the `tags` attribute. W\&B recommends that you reassign the `tags` attribute rather than mutate it in place, which is also a common Python best practice.

The following code snippet shows common ways to update the list of tags through reassignment. For brevity, it continues the code example from [Add a tag to an artifact version](#add-a-tag-to-an-artifact-version):

```python theme={null}
artifact.tags = [*artifact.tags, "new-tag", "other-tag"]
artifact.tags = artifact.tags + ["new-tag", "other-tag"]

artifact.tags = set(artifact.tags) - set(tags_to_delete)
artifact.tags = []  # deletes all tags
```

The following code snippet shows how you can use in-place mutation to update tags that belong to an artifact version:

```python theme={null}
artifact.tags += ["new-tag", "other-tag"]
artifact.tags.append("new-tag")

artifact.tags.extend(["new-tag", "other-tag"])
artifact.tags[:] = ["new-tag", "other-tag"]
artifact.tags.remove("existing-tag")
artifact.tags.pop()
artifact.tags.clear()
```

## View tags that belong to an artifact version

View the tags that belong to an artifact version linked to a registry with the W\&B UI or with the Python SDK.

<Tabs>
  <Tab title="W&B UI">
    Use the W\&B UI to view the tags that belong to an artifact version:

    1. Navigate to the [W\&B Registry](https://wandb.ai/registry).
    2. Click on a registry card.
    3. Click **View details** next to the name of the collection you want to add a tag to.
    4. Scroll down to the **Versions** section.

    If an artifact version has one or more tags, you can view those tags within the **Tags** column.

    <Frame>
      <img src="https://mintcdn.com/wb-21fd5541-style-guide-models-reports-20260604-104120/jYSdnAMvZ5q0Ye3Y/images/registry/tag_artifact_version.png?fit=max&auto=format&n=jYSdnAMvZ5q0Ye3Y&q=85&s=100482d81d06d0f3765716d131feefed" alt="Artifact version with tags" width="2708" height="1978" data-path="images/registry/tag_artifact_version.png" />
    </Frame>
  </Tab>

  <Tab title="Python SDK">
    Fetch the artifact version to view its tags. After you have the artifact version, view tags that belong to that artifact through the artifact object's `tags` attribute.

    Like other artifacts, you can fetch an artifact from W\&B without creating a run, or you can create a run and fetch the artifact within that run.

    Copy and paste one of the following code cells to add or modify an artifact version's tag. Replace the bracketed placeholders with your own values.

    The following code snippet shows how to fetch and view an artifact version's tags without creating a new run:

    ```python title="Add a tag to an artifact version without creating a new run" theme={null}
    import wandb

    ARTIFACT_TYPE = "[TYPE]"
    REGISTRY_NAME = "[REGISTRY-NAME]"
    COLLECTION_NAME = "[COLLECTION-NAME]"
    VERSION = "[ARTIFACT-VERSION]"

    artifact_name = f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}"

    artifact = wandb.Api().artifact(name = artifact_name, type = ARTIFACT_TYPE)
    print(artifact.tags)
    ```

    The following code snippet shows how to fetch and view artifact version's tags by creating a new run:

    ```python title="Add a tag to an artifact version during a run" theme={null}
    import wandb

    REGISTRY_NAME = "[REGISTRY-NAME]"
    COLLECTION_NAME = "[COLLECTION-NAME]"
    VERSION = "[ARTIFACT-VERSION]"

    with wandb.init(entity = "[ENTITY]", project="[PROJECT]") as run:

        artifact_name = f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}"

        artifact = run.use_artifact(artifact_or_name = artifact_name)
        print(artifact.tags)
    ```
  </Tab>
</Tabs>

## Remove a tag from an artifact version

Remove a tag from an artifact version when the tag no longer applies. Use the W\&B UI to remove a tag from an artifact version:

1. Navigate to the [W\&B Registry](https://wandb.ai/registry).
2. Click on a registry card.
3. Click **View details** next to the name of the collection you want to add a tag to.
4. Scroll down to **Versions**.
5. Click **View** next to an artifact version.
6. Within the **Version** tab, hover your mouse over the name of the tag.
7. Click on the cancel button (**X** icon).

## Find artifact versions with a specific tag

Use the W\&B Python SDK to programmatically locate every artifact version that shares a set of tags.

```python theme={null}
import wandb

api = wandb.Api()
tagged_artifact_versions = api.artifacts(
    type_name = "[ARTIFACT-TYPE]",
    name = "[ARTIFACT-NAME]",
    tags = ["[TAG-1]", "[TAG-2]"]
)

for artifact_version in tagged_artifact_versions:
    print(artifact_version.tags)
```
