# Configure Environment Variables

Set API keys and configuration for your agent.

## What Are Environment Variables?

Environment variables are configuration values your agent needs to operate:

* API keys (OpenAI, etc.)
* Database connections
* Feature flags
* Custom settings

## When to Configure

You can set environment variables:

* **During deployment** - In the deployment form (if shown)
* **After deployment** - Via Agent Dashboard → Config

## Common Variables

### LLM API Configuration

```bash
OPENAI_API_KEY=sk-...
OPENAI_BASE_URL=https://claw-api.agos.fun/v1
```

Note: AGOS Cloud provides built-in LLM API - you may not need external keys.

### External Service Keys

```bashn#
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
DISCORD_BOT_TOKEN=MTk...

# For external APIs
WEATHER_API_KEY=...
STOCK_API_KEY=...
```

### Agent Behavior

```bash
# Feature toggles
DEBUG=true
VERBOSE_LOGGING=false

# Timeouts and limits
REQUEST_TIMEOUT=30000
MAX_RETRIES=3
```

## How to Set

### Method 1: Agent Dashboard

1. Open your agent's OpenClaw Dashboard
2. Navigate to **Settings → Config**
3. Add or edit key-value pairs
4. Save changes
5. Restart agent if required

### Method 2: Configuration File

Some agents support config files:

```
.env
config.yaml
```

## Security Best Practices

✅ **DO**:

* Use environment variables for secrets (not code)
* Rotate API keys regularly
* Use minimal permissions for API keys

❌ **DON'T**:

* Hardcode secrets in your agent's code
* Share environment variables publicly
* Commit .env files to version control

## Viewing Current Variables

In Agent Dashboard:

```
Config → View all environment variables
```

Some values may be masked for security (e.g., API keys show as `***`).

## Updating Variables

1. Go to **Settings → Config**
2. Edit the value
3. Click **Save**
4. Some changes require agent restart

## Troubleshooting

### Variable Not Working

* Check for typos in key name
* Verify value format
* Ensure agent was restarted after changes

### Sensitive Values Exposed

* Re-generate API keys if leaked
* Check access logs for unauthorized usage

## Next Steps

→ [Connect Telegram or Discord](/agos/agos-cloud/quickstart/connect-messaging.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://agos.gitbook.io/agos/agos-cloud/quickstart/env-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
