Golem profiles and environments

From golemcloud/golem · View interactive version

Golem profiles and environments is an AI agent skill from the GitHub repository golemcloud/golem. Understanding Golem CLI profiles, application environments, and component presets. Use when configuring deployment targets, switching between local and cloud servers, managing CLI profiles, defining environment-specific presets, or understanding how environments, presets, and profiles interact.

How to use this skill

Skill file

Profiles, Environments, and Presets

Golem uses three related but distinct concepts for targeting deployments:

How They Relate

CLI Profile (connection settings)
    ↑ resolved from
App Environment (deployment target)
    ↓ activates
Component/Agent Presets (config overrides)

When you run golem deploy, the CLI:

  1. Selects an environment from the manifest (via --local, --cloud, -E <name>, or the default: true environment)
  2. Resolves connection settings — either from the environment's server: field, or falls back to the active CLI profile
  3. Activates presets listed in the environment's componentPresets: field, merging their overrides into the resolved configuration

CLI Profiles

Profiles are global CLI configuration stored in ~/.golem/config.json. They define server URLs and authentication credentials.

Built-in profiles

| Profile | Server | Auth |

|---------|--------|------|

| local | http://localhost:9881 | Built-in local token |

| cloud | https://release.api.golem.cloud | OAuth2 |

Managing profiles

golem profile new                          # Interactive setup
golem profile new my-staging --url https://staging.example.com                 # OAuth2 (default)
golem profile new my-staging --url https://staging.example.com --auth static   # static token (prompted, masked)
golem profile new my-staging --url https://staging.example.com --static-token "..."  # static token inline
golem profile list                         # List all profiles
golem profile switch my-staging            # Set active profile
golem profile get                          # Show active profile
golem profile get my-staging               # Show specific profile
golem profile delete my-staging            # Delete a profile
golem profile config my-staging set-format json  # Set default output format

Authentication mode is explicit via --auth: oauth2 (default — interactive

browser login on first use) or static (a pre-issued token). Passing

--static-token implies --auth static; --auth static without a token

prompts for one (masked). A token cannot be combined with --auth oauth2.

Global flags

golem -E staging deploy                    # Use a named manifest environment for this command
golem -L deploy                            # Shortcut: use "local" environment/profile
golem -C deploy                            # Shortcut: use "cloud" environment/profile

Profile fields

| Field | Description |

|-------|-------------|

| custom_url | Golem Component service URL |

| custom_worker_url | Golem Worker service URL (defaults to custom_url) |

| allow_insecure | Accept invalid TLS certificates |

| auth | Authentication — staticToken or OAuth2 |

| config.default_format | Default CLI output format (text, json, pretty-json, yaml, pretty-yaml, or toon) |

App Environments

Environments are defined in golem.yaml and represent named deployment targets. They specify which server to deploy to, which presets to activate, and optional CLI/deployment behavior.

For deployment subdomain fields, the environment's server controls expansion. A built-in local server resolves HTTP API subdomains to *.localhost:9006 and MCP subdomains to *.localhost:9007 by default; a built-in cloud server resolves them to *.apps.golem.cloud and *.mcps.golem.cloud. The environment name itself does not control the expansion.

Basic example

environments:
  local:
    default: true                    # Selected when no -E flag is given
    server: local                    # Use built-in local server
    componentPresets: local          # Activate the "local" preset
  cloud:
    server: cloud                    # Use built-in Golem Cloud
    componentPresets: cloud

Custom server example

environments:
  staging:
    server:
      url: https://staging.example.com
      auth:
        staticToken: "{{ STAGING_TOKEN }}"
    componentPresets: staging
  prod:
    account: my-org                  # Cloud account to deploy to
    server: cloud
    componentPresets: prod

Environment fields

| Field | Type | Description |

|-------|------|-------------|

| default | true | Mark as default environment (only one allowed) |

| account | string | Cloud account name for deployment |

| server | local, cloud, or custom object | Server connection settings |

| componentPresets | string or string[] | Preset name(s) to activate |

| cli | object | CLI behavior overrides (see below) |

| deployment | object | Deployment option overrides (see below) |

| version | object or string | Per-environment version override — see golem-deployment-version |

Server options

CLI options (`cli:`)

environments:
  local:
    server: local
    cli:
      format: json                   # Default output format
      autoConfirm: true              # Auto-answer "yes" to prompts
      redeployAgents: true           # Delete/recreate agents; agent state is lost

reset: true is equivalent to --reset: it deletes existing agents for the deployed components

after deployment, losing their state, and enables incompatibility-replacement fallbacks. The

environment itself is retained. It takes precedence over redeployAgents when both are configured.

Deployment options (`deployment:`)

environments:
  local:
    server: local
    deployment:
      compatibilityCheck: false      # Skip component compatibility checks
      versionCheck: false            # Enforce unique deploy versions; false = allow re-use (default)
      securityOverrides: true        # Allow security config overrides

Selecting an environment

| Flag | Effect |

|------|--------|

| -L / --local | Select the local environment (or local profile if no manifest) |

| -C / --cloud | Select the cloud environment (or cloud profile if no manifest) |

| -E <name> | Select a named environment from the manifest |

| (none) | Use the explicitly default environment, otherwise the first declared manifest environment |

Managing environments

golem environment list                     # List environments on the server
golem environment sync-deployment-options  # Sync deployment options to the server

Environment-scoped manifest sections

Load golem-edit-manifest for the full schema and editing rules of these manifest sections.

Several top-level manifest sections are keyed by environment name:

httpApi:
  deployments:
    local:                           # Only deployed to "local" environment
      - subdomain: my-app  # resolves to my-app.localhost:9006 by default
        agents:
          MyAgent: {}
    cloud:
      - subdomain: my-app  # resolves to my-app.apps.golem.cloud
        agents:
          MyAgent: {}

mcp:
  deployments:
    local:
      - subdomain: my-mcp  # resolves to my-mcp.localhost:9007 by default

secretDefaults:
  local:
    apiKey: "test-key"
  cloud:
    apiKey: "{{ PROD_API_KEY }}"

retryPolicyDefaults:
  local:
    default-retry:
      priority: 10
      predicate: "true"
      policy:
        countBox:
          maxRetries: 3
          inner:
            exponential:
              baseDelay: { secs: 1, nanos: 0 }
              factor: 2.0

resourceDefaults:
  local:
    api-calls:
      limit: { type: Rate, value: 100, period: minute, max: 1000 }
      enforcementAction: reject
      unit: request
      units: requests

Component and Agent Presets

Presets are named configuration overrides defined within components, agents, or component templates. They allow the same codebase to run with different settings per environment.

Defining presets

Load golem-edit-manifest when adding or modifying preset sections in golem.yaml to ensure correct manifest structure.

Presets can be defined at the component template, component, or agent level:

componentTemplates:
  shared-runtime:
    env:
      RUST_LOG: info
    presets:
      local:
        default: true                # Fallback when no selected preset name matches
        env:
          GOLEM_ENV: local
      cloud:
        env:
          GOLEM_ENV: cloud

components:
  my-app:service:
    templates: shared-runtime
    dir: service
    presets:
      local:
        build:
          - command: cargo build --target wasm32-wasip2
      release:
        build:
          - command: cargo build --target wasm32-wasip2 --release

agents:
  MyAgent:
    env:
      CACHE_TTL: "300"
    presets:
      local:
        env:
          CACHE_TTL: "60"
      cloud:
        env:
          CACHE_TTL: "3600"

What presets can override

Component presets can override: env, wasiConfig, plugins, files, config, build, componentWasm, customCommands, clean.

Agent presets can override: env, wasiConfig, plugins, files, config.

Presets cannot override structural fields like dir or templates.

How presets are activated

  1. Via environments: The componentPresets field in an environment selects preset(s) by name:

```yaml

environments:

local:

componentPresets: local # Activates "local" preset everywhere

staging:

componentPresets: [staging, debug] # Multiple presets (applied in order)

```

  1. Via CLI flag: The -P / --preset flag overrides environment preset selection:

```shell

golem build --yes -P release

golem deploy --yes -P debug,verbose

```

  1. Default preset: A component, agent, or template with custom presets always applies at least one custom preset. If no preset name selected by the environment or CLI matches that component, agent, or template, it applies its default custom preset. One custom preset can be marked default: true. If none is marked, the first custom preset in declaration order is the default, even if it is the only custom preset. This fallback is resolved independently for each component, agent, and template.

Presets named app-env:<environment-name> are environment presets, not custom presets. They apply only for the matching environment and do not participate in default selection.

Keeping presets opt-in

A single custom preset is not opt-in: it becomes the default and applies even without -P or componentPresets. To keep an override opt-in, add an empty custom preset marked default: true:

components:
  my-app:service:
    presets:
      standard:
        default: true
      debug:
        env:
          RUST_LOG: debug

The standard preset adds no overrides. The debug preset applies only when selected by componentPresets: debug in the environment or by -P debug on the CLI:

# Empty default if no matching environment selection
golem deploy --yes
# Enables the debug overrides
golem deploy --yes -P debug

Use the same empty-default pattern under a template's or agent's presets to keep its other presets opt-in. It also works for a preset that installs an optional plugin, such as OTLP: put the plugin in the opt-in preset and leave the default preset empty.

Naming guideline: Avoid using the same name for an environment and a preset (e.g. both called local). Although they are separate concepts, sharing names makes the manifest harder to read and reason about. Prefer distinct preset names such as dev, debug, release, or optimized that describe what the preset does, rather than mirroring the environment name.

Cascade with presets

Presets apply within their owning layer in the cascade:

componentTemplates (including their selected presets)
  → components (including their selected presets)
  → agents (including their selected presets)

Golem resolves the base component, including its template and component presets, before it applies

agent overrides and agent presets. Preset properties merge with or override the base properties of

their layer using the same merge modes (envMergeMode, pluginsMergeMode, etc.).

How the presets differ

The built-in Rust, MoonBit, and Go templates define a debug and a release preset. The template's

local environment selects debug and its cloud environment selects release. Both presets build

the same source, but in Rust and MoonBit the program can behave differently between them. Before you

deploy, test with the preset that the target environment selects, for example

golem build --yes -P release.

Rust. debug runs cargo build --target wasm32-wasip2, which uses Cargo's dev profile.

release runs cargo build --target wasm32-wasip2 --release with the generated

[profile.release] (opt-level = "s", lto = true, strip = "symbols"). Golem keeps Cargo's defaults for overflow-checks and debug-assertions:

debug checks integer overflow and runs debug_assert!, and release does neither. For example,

u8::MAX + 1 on a runtime value panics in debug and fails the invocation, but gives 0 in

release. A failing debug_assert! panics only in debug. When code must behave the same in both

presets, use checked_add, wrapping_add, or saturating_add and assert!, or set

the same overflow-checks and debug-assertions values in [profile.dev] and in the generated

[profile.release].

MoonBit. debug runs moon build --target wasm and release runs

moon build --target wasm --release. The targets option in a package's moon.pkg can give a file

a debug or release condition, and moon then compiles that file only into the matching build:

options(
  targets: {
    "checks_debug.mbt": [ "debug" ],
    "checks_release.mbt": [ "release" ],
  },
)

With such conditions the two presets compile different files, so the behavior can differ between

them. Golem does not check or warn about these conditions. A package whose targets names no

debug or release condition compiles the same files in both presets.

Go. Both presets run the same componentize-go build. release then removes the name custom

section, which holds the Go function names, with wasm-tools strip. This section is removable debug

metadata, so the behavior does not differ between the presets. Only Wasm trap backtraces of a

release build show function indexes instead of function names.

Per-Agent Configuration

Configuration in the manifest is per agent. Each agent type can have its own:

agents:
  EscalationAgent:
    env:
      MODEL: claude-3-7-sonnet
      JIRA_TOKEN: "{{ JIRA_TOKEN }}"
    files:
      - sourcePath: ./prompts/escalation-system.md
        targetPath: /prompts/system.md
    config:
      projectKey: OPS
      defaultPriority: high

  AuditAgent:
    env:
      S3_BUCKET: supportdesk-audit
    config:
      retentionDays: 90

Each agent can also have its own presets, allowing environment-specific overrides per agent type.

Common Patterns

Local development + cloud production

componentTemplates:
  shared:
    env:
      LOG_LEVEL: info
    presets:
      local:
        env:
          LOG_LEVEL: debug
      cloud:
        env:
          LOG_LEVEL: warn

environments:
  local:
    default: true
    server: local
    componentPresets: local
  prod:
    server: cloud
    componentPresets: cloud

Multiple staging environments

environments:
  local:
    default: true
    server: local
    componentPresets: local
  staging:
    server:
      url: https://staging.example.com
      auth:
        staticToken: "{{ STAGING_TOKEN }}"
    componentPresets: staging
  prod:
    account: my-org
    server: cloud
    componentPresets: prod

Profile without a manifest

When no golem.yaml is found, the CLI falls back to profiles:

golem profile new my-server --url https://my-server.example.com --static-token "..."
golem --profile my-server component list   # Use profile directly
golem -L component list                    # Use built-in "local" profile

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.