golemcloud/golem/golem-add-config-go
- community
Checking that the SKILL.md file is still in the repository.
Adding typed configuration to a Go Golem agent with DefineConfiguredAgent and ctx.Config. Use when the user asks about agent config, configuration values, config structs, or passing settings to a Go agent.
Install
npx vskill@latest install golemcloud/golem/golem-add-config-goSKILL.md
Adding Typed Configuration to a Go Agent
Overview
A Go agent's configuration is a single config struct attached to the agent's type. Each exported field becomes a config key; the platform provisions the values (from golem.yaml, env, or the CLI) and the agent reads them back at runtime as a typed struct. Config is materialized once per worker and cached, so reads on a hot method are near-free.
Two things change versus a plain agent:
- define with
golem.DefineConfiguredAgent[ID, Cfg]instead ofgolem.DefineAgent[ID], - implement with
Agent.ImplementConfigured(its constructor receives an*golem.InitContext[ID, state, Cfg]),
then read the config with ctx.Config(Agent) inside a method, or ctx.Config() inside the constructor.
Steps
- Declare the config struct — one exported field per config key.
- Attach it with
golem.DefineConfiguredAgent[ID, Cfg]in the definition. - Implement with
Agent.ImplementConfigured; read config from theInitContextin the constructor. - Read at method time with
ctx.Config(Agent). - Provide values under
agents.<Name>.configingolem.yaml.
Definition (agents/shop/shop.go)
Field-name conventions match plain agent types: use sized integers (int64, not bare int), a *T field is option<T>, and nested structs recurse. Field names are lowerCamelCase for the wire, with each initialism as one word (RatePct → ratePct, APIKey → apiKey, AccountID → accountId).
Implementation (agents/shop/impl/impl.go)
ctx.Config(shop.Agent) returns the whole shop.Config value; ctx is the running method's *golem.Context[state] (requiring it means config is only readable from inside a running method). The constructor reads the same config via ctx.Config() on its InitContext.
A config field takes the same golem restriction tag as a method parameter (see golem-add-agent-go), which publishes it in the config's declared type:
Providing Values in golem.yaml
Set defaults under agents.<Name>.config. Keys are camelCase — they match the Go field names in lowerCamelCase, with each initialism as one word (AccountID → accountId); nested structs are nested maps, and a map[string]V is a list of [key, value] pairs:
Overriding Config Over RPC
When one agent calls another, the caller can override the callee's local (non-secret) config at client creation with the callee definition's WithConfig, which checks the config type at compile time:
Only declared local keys can be overridden; secret fields are always platform-provisioned and are skipped. WithConfig replaces every local value: it sends every local field of the struct, zero values included. To set only some, or to call an agent in another component, use the generated guest client's With<Agent>Config option (see golem-call-another-agent-go). It sends only the fields you set, through golem.WithConfigEntries(golem.ConfigEntryOf(path, value)…).
Key Constraints
- Config is agent-attached and instance-bound — read only from within that agent's own constructor or methods, never from free-floating code.
- Reading an undeclared key, or an unset required key, traps. Declare a field as a pointer (
*T) to read an absent value back asnilinstead of trapping. - Config is materialized once per worker and cached; local fields are read on first access and reused for the worker's life. (Secret fields stay live — see
golem-add-secret-go.) - Use
golem.DefineAgent[ID](no config) for agents that need none;golem.NoConfigis the empty config type and never needs naming.
Related Skills
| Skill | When to Load | |
|---|---|---|
golem-add-agent-go | Define the base agent this config attaches to | |
golem-add-secret-go | Add golem.Secret[T] fields for sensitive values | |
golem-call-another-agent-go | Override a callee's config with the definition's WithConfig over RPC |
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggolem-skills/skills/go/golem-add-config-go/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/golemcloud/golem/golem-add-config-go)