Resolves and validates plugin configuration.
Config resolution merges three sources (in order of precedence):
- Per-agent overrides (highest priority)
- Application environment config (
Application.get_env(otp_app, plugin_module)) - Default values from the plugin's config_schema (lowest priority)
Example
# In config/config.exs:
config :my_app, MyApp.SlackPlugin,
token: "default-token",
channel: "#general"
# In agent definition:
use Jido.Agent,
plugins: [
{MyApp.SlackPlugin, %{channel: "#support"}} # Override channel
]
# Resolved config:
%{token: "default-token", channel: "#support"}
Summary
Functions
Resolves configuration for a plugin module by merging app env with overrides.
Like resolve_config/2 but raises on validation errors.
Functions
Resolves configuration for a plugin module by merging app env with overrides.
Parameters
plugin_module- The plugin module (must implementotp_app/0and optionallyconfig_schema/0)overrides- Per-agent config overrides (map)
Returns
{:ok, resolved_config}- Successfully resolved and validated config{:error, errors}- Validation errors from Zoi schema
Examples
Config.resolve_config(MyApp.SlackPlugin, %{channel: "#support"})
# => {:ok, %{token: "env-token", channel: "#support"}}
Config.resolve_config(MyApp.SlackPlugin, %{invalid: "field"})
# => {:error, validation_errors}
Like resolve_config/2 but raises on validation errors.
Examples
Config.resolve_config!(MyApp.SlackPlugin, %{channel: "#support"})
# => %{token: "env-token", channel: "#support"}
Config.resolve_config!(MyApp.SlackPlugin, %{invalid: "field"})
# Raises ArgumentError when the resolved config fails schema validation.