LOG_LEVEL=info, or a reference that Beam fills in when you deploy, such as a secret, a database connection string, or another app’s URL.
Create a Secret
Store API keys and other credentials as workspace secrets so they stay out of your code. In the dashboard, go to Settings → Secrets, click Create secret, and enter a name and value. Or create one from the CLI:Set Environment Variables
Set variables in your code or when you deploy. To pass a secret, use${{secret.NAME}} as the value:
--env are added to the env in your code and replace any variable with the same name.
Your app reads them like any other environment variable:
KEY=VALUE per line, such as OPENAI_API_KEY=${{secret.OPENAI_API_KEY}}. Stage the change, then click Deploy changes to deploy a new version.
Reference Databases and Apps
References also connect an app to a database or another app. Beam checks references when you deploy, so create the database or deploy the other app first.
Database fields are case-sensitive, so write them in uppercase.
URL is an alias for the connection string.
randomInt() can be part of a longer value, such as ${{app.api.URL}}/health.
Generated Values
${{secret(32)}} generates a 32-character secret on the first deploy and saves it as a workspace secret named after the app and the variable. For example, SESSION_KEY on the web app is saved as WEB_SESSION_KEY. Later deploys reuse it. The length can be 1–512, and an optional second argument sets the alphabet, as in ${{secret(16, "abcdef0123456789")}}.
${{randomInt(10, 100)}} inserts an integer from 10 through 99, picked again on every deploy. randomInt(100) and randomInt() both use 0–99.
Update Variables and Secrets
You can also change variables with MCP’sset_env and connect_services tools, which deploy a new version.
A new secret value, set in the dashboard, with beam secret update, or with MCP’s update_secret, takes effect the next time a serverless container starts. Brokered VM/sandbox runtime secrets refresh on the next request after the worker’s 15-second cache expires, without restarting the guest. For plaintext build-time secrets, use Image.with_secrets().