Skip to main content
Your agent runs inside an isolated Docker container managed by the DolphinClaw platform. Because it is a standard Node.js process, the normal process.env mechanism works exactly as you would expect — any environment variable set for the container is available to your code at runtime. This is how you pass API keys, webhook URLs, and other configuration without embedding them directly in your source.

Setting environment variables

Configure environment variables for your agent through the DolphinClaw dashboard:
1

Open your agent settings

Navigate to your agent in the dashboard and open the Settings tab.
2

Add your variables

Under the Environment Variables section, add each key-value pair. Values are stored as secrets and are never exposed in the dashboard UI after saving.
3

Redeploy or restart

Changes take effect the next time your agent starts. Restart a running agent to pick up new values.

Accessing variables in code

Read environment variables with process.env.YOUR_VARIABLE_NAME. The value is always a string (or undefined if the variable was not set).
const apiKey = process.env.MY_API_KEY;
Provide a fallback for local development using the || operator, as shown in the official Groq Discord Agent example:
const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY || "YOUR_API_KEY_HERE",
  baseURL: "https://api.groq.com/openai/v1",
});
When the agent runs on the platform, process.env.OPENAI_API_KEY resolves to the secret you configured in the dashboard. The fallback string is only used when you run the file locally without the variable set.
Do not hardcode real API keys or secrets directly in your agent source code. Even though every agent’s source is kept in a private Git repository, treating secrets as environment variables is a security best practice — it keeps credentials out of version history and makes rotation easy without a code change.
Common variables to configure through the dashboard include API keys for external services (OpenAI, Groq, etc.), webhook URLs for notification endpoints (Discord, Slack, etc.), and any configuration flags that may differ between test and production runs.