golem-add-config-rust

Adds typed configuration to Rust Golem agents using Config<T> and ConfigSchema.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-add-config-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-add-config-rust
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/rust/golem-add-config-rust
Command: npx skills add https://github.com/golemcloud/golem --skill golem-add-config-rust

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust developers building Golem agents need a structured way to pass validated, typed configuration values into agent constructors instead of relying on untyped environment variables or ad-hoc parsing.

Core Features & Use Cases

  • Typed Config Structs: Derive ConfigSchema on Rust structs, including nested structs via #[config_schema(nested)] and optional Option<T> fields.
  • Constructor Injection: Inject Config<T> into the agent constructor with the required #[agent_config] annotation, with lazy loading via .get().
  • Multi-Source Configuration: Set defaults in golem.yaml under agents.<Name>.config, override via golem agent new --config CLI flags, or override at call time with the generated *ConfigRpc type and get_with_config.
  • Use Case: You are building a Rust Golem agent that needs a numeric threshold, a string endpoint, and nested feature flags. Define a ConfigSchema struct, add Config<MyAgentConfig> to the constructor, and supply values through golem.yaml or CLI flags.

Quick Start

Ask the AI to add typed configuration with a ConfigSchema struct and an #[agent_config] Config<T> constructor parameter to your Rust Golem agent.

Frequently Asked Questions about golem-add-config-rust

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add typed configuration to a Rust Golem agent?

Derive ConfigSchema on a struct defining your config fields, then add a Config<MyConfig> parameter annotated with #[agent_config] to the agent constructor. Access values lazily by calling .get() on the Config instance.

How do I pass config values to a Golem agent from the CLI?

Use golem agent new with repeated --config flags, such as --config foo=42. Nested struct fields are addressed with dot-separated keys like --config nested.a=true, and these values override golem.yaml defaults.

Does Golem agent config support nested structs and optional fields?

Yes. Nested structs require the #[config_schema(nested)] attribute on the field, and all nested fields must implement ConfigSchema. Option<T> fields are optional and default to None when not provided.

Why should I not call Config::new() manually in Golem agent code?

Config<T> metadata is discovered from the #[agent_config] constructor parameter, so manual construction bypasses that registration path. Always declare Config<T> as an annotated constructor parameter and let the framework inject it.

Can I override agent config at RPC call time in Golem?

Yes. Use the generated *ConfigRpc type and call get_with_config with the agent name and config overrides. This follows the config cascade where call-time values override golem.yaml defaults.