> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slai.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Shipping Metrics Outside Slai

> Shipping metrics to a third party tool is fairly straightforward. In this example, we'll log our training metrics to Weights and Biases (WandB) to track our experiments.

## Add your WandB API key to Slai

You can add your WandB API key to the [Slai Secrets Manager](/dashboard/secrets-management). If you don't yet have a WandB account, [you can signup for one here](/slai).

<img src="https://mintcdn.com/slai-docs/x8Ejwqb1sXwT0acS/img/secrets_manager.png?fit=max&auto=format&n=x8Ejwqb1sXwT0acS&q=85&s=b077f9441649793dc170ade2d3ddf434" alt="Secrets Manager" width="2878" height="796" data-path="img/secrets_manager.png" />

## Import the API key in the sandbox

You can access stored secrets in your sandbox through the `os.environ` object. We'll login to WandB with our API key:

```python theme={null}
wandb.login(key=os.environ['SLAI_WANDB_API_KEY'])
```

## Logging metrics during training

To log metrics directly to WandB, you can add the following code to your training script. The `wandb.log()` method will record whatever data you wish to pass in during your training process.

```python theme={null}
import wandb

wandb.login(key=os.environ['SLAI_WANDB']) # add your own API key

def train():
  for x in range(10):
    run = wandb.init(reinit=True)
    for y in range (100):
      wandb.log({"metric": x+y})
    run.finish()
```
