# Artifacts in Sandboxes

> For AI agents: the complete documentation index is at https://buddy.works/llms.txt

Fetch an artifact version into a Buddy Sandbox with bdy sb fetch, refresh it later, and grant the Sandbox access to the artifact in the Permissions tab.

Artifact versions can be downloaded to a sandbox using fetch sources. Each fetch source specifies an artifact, its version, and a destination directory in the sandbox. Buddy transfers the files without storing artifact authentication tokens in the sandbox. Artifact permissions for sandboxes are configured in the **Sandbox** section of the artifact's Permissions tab.

The fetch mechanism, including fetching repositories, is described in [Git and Artifacts](https://buddy.works/docs/sandboxes/git-and-artifacts.md).

## Artifact fetch sources

### Fetch source configuration in the UI

In the sandbox settings, in the **Fetch** section, click **+** and select **Artifact**. Then select the artifact version and enter the directory in the **Path** field.

![Adding an artifact to the Fetch section of a Sandbox](https://buddy.works/docs/artifacts/artifact-sandbox-fetch-add.png)

### Fetch source configuration using the CLI

You add an artifact fetch source to an existing sandbox with `bdy sb fetch add` and the `--artifact name:version` flag. The `--path` flag sets the directory in the sandbox, and `--source-path` downloads a single file instead of the whole version:

```bash
bdy sb fetch add my-sandbox --artifact my-app-build:1.2.0 --path /home/buddy/dist
bdy sb fetch add my-sandbox --artifact my-app-build:1.2.0 --source-path dist.zip --path /home/buddy/archive
```

A fetch is identified by its target directory, so two sources cannot go to the same directory. `bdy sb fetch ls` lists the sources and their state, and `bdy sb fetch refetch` downloads a source again:

```bash
bdy sb fetch ls my-sandbox
bdy sb fetch refetch my-sandbox /home/buddy/dist
```

A fetch source configured with `my-app-build:latest` references the version explicitly named `latest`, not the most recently published version. Refetching retrieves the current contents of that version. For a complete list of available flags, see the [`bdy sandbox fetch` reference](https://buddy.works/docs/cli/sandbox/fetch.md).

## Sandbox permissions

Open the artifact, go to the **Permissions** tab and check the **Sandbox** section:

- the **All sandboxes** row sets the level for all sandboxes at once,
- the **+** button adds a single sandbox with its own level,
- the **Environment** section grants a level to sandboxes created in a given environment.

The available permission levels are the same as for pipelines: **Manage**, **Read-write**, **Read-only**, and **Deny**. By default, new artifacts have the **All sandboxes** permission level set to **Deny**, regardless of the configured pipeline permissions. If a fetch operation fails due to insufficient permissions, verify the effective permission level of the sandbox.

![Sandbox with Read-only access in the Permissions tab of an artifact](https://buddy.works/docs/artifacts/artifact-permissions-sandbox.png)

Missing access already shows in the sandbox settings: the section header changes to **Fetch: Permissions missing**, with a **Grant permission** link next to it that grants the sandbox access to the artifact. Then download the source again, for example with `bdy sb fetch refetch`.

![Fetch section of a Sandbox without access to the artifact](https://buddy.works/docs/artifacts/artifact-sandbox-fetch-permissions-missing.png)

The precedence of rules for a single sandbox and for an environment is described on the [Permissions and security](https://buddy.works/docs/sandboxes/permissions-and-security.md) page, and the levels for pipelines and workspace roles on the [Permissions and access](https://buddy.works/docs/artifacts/permissions-and-access.md) page.

## Fetch source configuration in YAML

Artifact fetch sources are defined in the `fetch` list of the sandbox configuration:

```yaml
- sandbox: web-app-preview
  name: web-app-preview
  os: ubuntu:24.04
  resources: 1x2
  fetch:
  - path: /home/buddy/app
    artifact: web-app-build:build-2
```

## Artifacts and sandbox snapshots

Artifacts store versioned resources independently of the sandbox filesystem. A [sandbox snapshot](https://buddy.works/docs/sandboxes/snapshots.md) captures the state of the sandbox, including its filesystem and installed tools.

See also:

- [Git and Artifacts](https://buddy.works/docs/sandboxes/git-and-artifacts.md) - fetching repositories and artifacts, order during provisioning
- [Permissions and access](https://buddy.works/docs/artifacts/permissions-and-access.md) - artifact access levels for pipelines and sandboxes
- [Artifacts in the CLI](https://buddy.works/docs/artifacts/cli.md) - publishing and downloading versions with `bdy artifact`
- [Troubleshooting](https://buddy.works/docs/artifacts/troubleshooting.md) - error messages when working with artifacts


---
Original source: https://buddy.works/docs/artifacts/sandboxes