# Environment variables

You can configure your code to accept external parameters at runtime, overriding default any values in your code.  These parameters, called _Experiment Environment Variables_, are automatically captured and tracked in Gradient. &#x20;

#### Code sample:

```python
train_epochs=int(os.environ.get('TRAIN_EPOCHS', 40)),
epochs_between_evals=int(os.environ.get('EPOCHS_EVAL', 100)),
batch_size=int(os.environ.get('BATCH_SIZE', 100)),
```

#### Adding parameters to Experiment:

The syntax for these parameters in the CLI is JSON.

```python
gradient experiments ... --experimentEnv "{\"EPOCHS_EVAL\":5,\"TRAIN_EPOCHS\":2,\"MAX_STEPS\":5,\"EVAL_SECS\":10}"  
```

These parameters will be injected into the Experiment at runtime and captured in Gradient.

![](https://1320806315-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHZRFUkajubOAmgu6Rd%2F-LxxeWokdeUv9_MJz4l8%2F-Lxxg4ScMoaQC8QJx5Mw%2Fimage.png?alt=media\&token=2c442759-dd8e-4f9c-b97c-b2404d0d37f3)

#### Injecting Secrets:

{% hint style="warning" %}
Secrets are currently limited to experiments run on private clusters
{% endhint %}

[Secrets](../../secrets/using-secrets) can be injected into variables using the following syntax:

```python
gradient experiments ... --experimentEnv '{"MY_SECRET":"secret:<secret_name>"}' 
```
