Golem configure api domain

From golemcloud/golem · View interactive version

Golem configure api domain is an AI agent skill from the GitHub repository golemcloud/golem. Configuring HTTP API domain deployments and security schemes in golem.yaml. Use when the user asks to deploy agents to a domain, configure API domains, set up authentication/security schemes (OIDC), or manage the httpApi section of the application manifest.

How to use this skill

Skill file

Configuring HTTP API Domain Deployments

Overview

After adding HTTP mounts and endpoints to agents in code, you must configure an HTTP API deployment in golem.yaml so Golem knows which agents to expose and on which domain. This skill covers the httpApi manifest section, security scheme setup, and the auto-generated OpenAPI specification.

Adding a Domain Deployment

Add an httpApi section to the root golem.yaml:

httpApi:
  deployments:
    local:
    - subdomain: my-app  # resolves to my-app.localhost:9006 by default
      agents:
        TaskAgent: {}
        UserAgent: {}

Structure

Define exactly one of subdomain or domain on each deployment. Prefer subdomain for built-in server: local and server: cloud environments. Use domain when you need a full custom domain. subdomain cannot be used with custom server environments — those must use domain.

Do not use localServer.customRequestPort: 0 in the manifest. Port 0 is only allowed when passed directly as --custom-request-port 0 to golem server run; manifest deployment domains require stable nonzero ports. The local server routes requests by matching their Host header against the expanded <subdomain>.localhost:<port>, so the running server must bind the same port the manifest expands to: golem server run warns when its --custom-request-port differs from the manifest value, and such deployments are not reachable until the two match.

<subdomain>.localhost resolves only on the machine running the local server. The HTTP API listener defaults to worker_service.bind_address = "127.0.0.1", independently of localServer.routerAddr. External access requires a reachable domain, an appropriate worker-service bind address, and network access rules; DNS alone is insufficient. Replace all well-known default secrets before exposing any listener, including only the HTTP API listener: the server rejects a non-loopback listener while well-known secrets remain configured. Changing the worker-service bind address also exposes its unauthenticated internal gRPC listener: restrict that listener with a firewall and keep other internal services on loopback. See golem-local-dev-server for configuration details.

Agent Options

Each agent entry accepts these optional fields:

agents:
  TaskAgent: {}                          # Default — no auth, no test header
  SecureAgent:
    securityScheme: my-oidc              # Reference a security scheme by name
  DevAgent:
    testSessionHeaderName: X-Test-Auth   # Use a test header for development

Security Schemes

Security schemes define OIDC authentication providers. They are managed via the Golem CLI:

Creating a Security Scheme

golem api security-scheme create my-oidc \
  --provider-type google \
  --client-id "YOUR_CLIENT_ID" \
  --client-secret "YOUR_CLIENT_SECRET" \
  --redirect-url "http://my-app.localhost:9006/auth/callback" \
  --scope openid --scope email --scope profile

Supported Providers

| Provider | --provider-type value |

|---|---|

| Google | google |

| Facebook | facebook |

| Microsoft | microsoft |

| GitLab | gitlab |

| Custom OIDC | custom (requires --custom-provider-name and --custom-issuer-url) |

For a custom OIDC provider:

golem api security-scheme create my-custom-oidc \
  --provider-type custom \
  --custom-provider-name "My OIDC" \
  --custom-issuer-url "https://auth.example.com" \
  --client-id "YOUR_CLIENT_ID" \
  --client-secret "YOUR_CLIENT_SECRET" \
  --redirect-url "https://app.example.com/auth/callback" \
  --scope openid

Managing Security Schemes

golem api security-scheme get my-oidc           # View details
golem api security-scheme update my-oidc ...     # Update fields
golem api security-scheme delete my-oidc         # Delete

Referencing in golem.yaml

After creating a security scheme, reference it by name in the agent deployment options:

httpApi:
  deployments:
    local:
    - subdomain: my-app  # resolves to my-app.localhost:9006 by default
      agents:
        SecureAgent:
          securityScheme: my-oidc

This enables OIDC authentication for all endpoints on SecureAgent that have auth: true set in their code-level annotations.

Test Session Header (Development)

For local development without a real OIDC provider, use a test session header:

httpApi:
  deployments:
    local:
    - subdomain: my-app  # resolves to my-app.localhost:9006 by default
      agents:
        SecureAgent:
          testSessionHeaderName: X-Test-Auth

Then pass identity in requests. The header value must be a JSON object representing an OIDC session. All fields have defaults, so only subject is needed to identify the caller:

curl -H 'X-Test-Auth: {"subject":"test-user-id"}' http://my-app.localhost:9006/secure/agent1/data

Available fields (all optional, with defaults):

| Field | Type | Default |

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

| subject | string | "test-user" |

| issuer | string (URL) | "http://test-idp.com" |

| email | string | null |

| name | string | null |

| email_verified | boolean | null |

| given_name | string | null |

| family_name | string | null |

| picture | string (URL) | null |

| preferred_username | string | null |

| scopes | array of strings | ["openid"] |

| issued_at | ISO 8601 datetime | current time |

| expires_at | ISO 8601 datetime | current time + 8 hours |

⚠️ Important: The header value must be valid JSON — a plain string like "user1" will be rejected with a 400 error.

Multi-Environment Deployments

Define different domains and security configurations per environment:

httpApi:
  deployments:
    local:
    - subdomain: my-app  # resolves to my-app.localhost:9006 by default
      agents:
        TaskAgent: {}
        SecureAgent:
          testSessionHeaderName: X-Test-Auth
    cloud:
    - subdomain: my-app  # resolves to my-app.apps.golem.cloud
      agents:
        TaskAgent: {}
        SecureAgent:
          securityScheme: prod-google-oidc

environments:
  local:
    server: local
  cloud:
    server: cloud

Webhook URL

If agents use webhooks, configure the webhook path prefix:

httpApi:
  deployments:
    local:
    - subdomain: my-app  # resolves to my-app.localhost:9006 by default
      webhookUrl: /my-custom-webhooks/
      agents:
        WebhookAgent: {}

The deployment domain comes from subdomain or domain. The webhookUrl path prefix is combined with the agent's webhookSuffix (defined in code) and the generated webhook ID to form the full callback URL, such as http://my-app.localhost:9006/my-custom-webhooks/order-hooks/<id>.

Deploying

After configuring golem.yaml, deploy. Always use --yes to avoid interactive prompts:

golem deploy --yes                     # Deploy all components and HTTP API
golem deploy --yes --reset             # Deploy and delete all previously created agents
golem deploy --yes --update-agents auto # Deploy and update running agents

Auto-Generated OpenAPI

Golem automatically serves an OpenAPI specification at /openapi.yaml on each deployment domain:

curl http://my-app.localhost:9006/openapi.yaml

This specification includes all endpoints from all agents deployed to that domain, with proper path parameters, request/response schemas, and CORS metadata.

Complete Example

# golem.yaml

httpApi:
  deployments:
    local:
    - subdomain: task-app  # resolves to task-app.localhost:9006 by default
      webhookUrl: /webhooks/
      agents:
        TaskAgent: {}
        AdminAgent:
          testSessionHeaderName: X-Admin-Auth
    cloud:
    - subdomain: task-app  # resolves to task-app.apps.golem.cloud
      agents:
        TaskAgent: {}
        AdminAgent:
          securityScheme: google-oidc

environments:
  local:
    server: local
  cloud:
    server: cloud

Key Constraints

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.