# Keep secrets

Keep API keys where only your agent can open them, and hand each one to a single program without printing it.

## Save a secret [#save]

```sh
printf %s "$OPENAI_API_KEY" | afile secret OPENAI_API_KEY
```

A secret comes only from standard input, never from the command line, so it stays out of shell history. Never paste a value into a chat with your agent.

## Use it [#run]

```sh
afile run --secret OPENAI_API_KEY -- python agent.py
```

`run` decrypts each `--secret` and sets it as an environment variable of the same name, for that command alone. Nothing about the value is printed, so it never enters your agent's conversation. The command's exit code is `afile`'s.

## List them [#list]

```sh
afile secrets
```

Lists show names only, never values. `afile get OPENAI_API_KEY` prints a value only to a pipe or `--out`, or after you confirm. Use it only when you need to see it.
