Working with Plugin Settings in FabrCore
FabrCore uses a simple, convention-based approach to plugin settings through AgentConfiguration.Args. No schema system needed — just a naming convention and extension methods.
The Settings Convention
Plugin settings use a PluginAlias:Key naming convention stored as flat string values in the agent's Args dictionary. The PluginConfigExtensions class provides helper methods:
// Read a single setting
var rootPath = config.GetPluginSetting("FileSystem", "RootPath");
// Read all settings for a plugin (returns Dictionary)
var settings = config.GetPluginSettings("FileSystem");
Configuration in JSON
Settings appear in the agent configuration's Args section:
{
"Handle": "my-agent",
"AgentType": "assistant",
"Models": "default",
"Args": {
"FileSystem:RootPath": "/tmp/files",
"FileSystem:MaxFileSize": "10485760",
"WebBrowser:TimeoutMs": "30000",
"WebBrowser:Headless": "true"
}
}
Using Settings in a Plugin
[PluginAlias("FileSystem")]
public class FileSystemPlugin : IFabrCorePlugin
{
private string _rootPath = "/tmp/files";
public Task InitializeAsync(
AgentConfiguration config,
IServiceProvider serviceProvider)
{
var rootPath = config.GetPluginSetting(
"FileSystem", "RootPath");
if (!string.IsNullOrEmpty(rootPath))
_rootPath = rootPath;
return Task.CompletedTask;
}
}
Why Not a Framework Schema?
You might wonder why FabrCore doesn't include a [PluginSetting] attribute or a schema discovery API. The reason is simple: settings schema discovery is only valuable when there's a UI rendering settings forms, and that UI is your application's responsibility.
Different applications have different UI frameworks (Blazor, React, etc.) with different schema requirements. A 76-line settings registry mapping plugin aliases to their settings is reasonable application code — explicit, easy to maintain, and tailored to your specific UI.
Learn More
Check out the plugin settings documentation for the complete reference.
Builder of FabrCore and OpenCaddis.