Leveraging FabrCore's Built-in Discovery System
Some teams build custom addon discovery systems from scratch — attribute scanning, assembly loading, service registration — not realizing FabrCore already handles this for agents, plugins, and tools.
What FabrCore Already Discovers
FabrCore has three built-in discovery mechanisms that run at startup:
FabrCoreServerOptions.AdditionalAssemblies— Ensures assemblies from external projects are loaded and scannedFabrCoreToolRegistry— Scans all loaded assemblies for[PluginAlias]and[ToolAlias]attributesFabrCoreRegistry— Scans for[AgentAlias]attributes to discover agent types
Loading External Assemblies
If your agents, plugins, or tools live in separate assemblies, pass them via AdditionalAssemblies:
builder.AddFabrCoreServer(new FabrCoreServerOptions
{
AdditionalAssemblies = new List<Assembly>
{
typeof(MyCustomAgent).Assembly,
typeof(MyPluginLibrary).Assembly
}
});
That's it. No custom attribute scanning, no Assembly.LoadFrom(), no AppDomain.CurrentDomain.GetAssemblies() loops. FabrCore handles the rest.
Verify with the Discovery Endpoint
Hit GET /fabrcoreapi/Discovery during development to confirm your components were picked up:
{
"agents": [
{ "typeName": "MyApp.AssistantAgent", "aliases": ["assistant"] }
],
"plugins": [
{ "typeName": "MyApp.WeatherPlugin", "aliases": ["weather"] }
],
"tools": [
{ "typeName": "MyApp.MathTools.Add", "aliases": ["add-numbers"] }
]
}
When Custom Discovery Makes Sense
FabrCore's discovery is scoped to its domain: agents, plugins, and tools. For other concerns, use the appropriate .NET mechanism:
- Blazor/Razor components: Use ASP.NET Core's
AddApplicationPart() - App-specific services: Register in your
Program.csstartup - Middleware: Use
IStartupFilteror standard pipeline configuration
Building a custom addon discovery system for these is reinventing what ASP.NET Core already provides. Keep FabrCore discovery for FabrCore components, and use the framework's patterns for everything else.
Learn More
Check out the FabrCoreRegistry documentation for the complete discovery reference.
Builder of FabrCore and OpenCaddis.