resolveConfig
resolveConfig<
T>(ctx,gadgetName,config):T
Defined in: utils/config-resolver.ts:130
Bulk configuration resolution for subagent gadgets.
Takes a map of config keys to their resolution options and returns a fully resolved configuration object.
Type Parameters
Section titled “Type Parameters”T extends Record<string, unknown>
Parameters
Section titled “Parameters”ExecutionContext from gadget execution
gadgetName
Section titled “gadgetName”string
Name of the subagent gadget (e.g., “BrowseWeb”)
config
Section titled “config”{ [K in string | number | symbol]: ResolveValueOptions<T[K]> }
Map of config keys to resolution options
Returns
Section titled “Returns”T
Fully resolved configuration object
Example
Section titled “Example”// Before: 27 lines of manual fallback logicconst subagentConfig = ctx.subagentConfig?.Dhalsim ?? {};const parentModel = ctx.agentConfig?.model;const model = params.model ?? subagentConfig.model ?? parentModel ?? "sonnet";const maxIterations = params.maxIterations ?? subagentConfig.maxIterations ?? 15;const headless = params.headless ?? subagentConfig.headless ?? true;
// After: One function callconst { model, maxIterations, headless } = resolveConfig(ctx, "BrowseWeb", { model: { runtime: params.model, subagentKey: "model", parentKey: "model", defaultValue: "sonnet", handleInherit: true }, maxIterations: { runtime: params.maxIterations, subagentKey: "maxIterations", defaultValue: 15 }, headless: { runtime: params.headless, subagentKey: "headless", defaultValue: true },});