Skip to content



The source code of this example is available in the Playground.

Secrets can be used to pass passwords and tokens securely to workflows without hard-coding them in the code.

Secrets can be added via the dstack secrets command and accessed from the workflow via environment variables.


Here's an example of how to use your Weight & Biases API token in your workflows.

Go to the settings of your Weight & Biases user and copy your API token.

Use the dstack secrets add command to add it as a secret:

$ dstack secrets add WANDB_API_KEY acd0a9d1ebe3a4e4854d2f6a7cef85b5257f8183

Now, when you run any workflow, your API token will be passed to the workflow via the WANDB_API_KEY environment variable:

  - name: hello
    provider: bash
      - conda install wandb
      - wandb login

Secrets can be managed via the dstack secrets command.