Plugin System¶
aifred-tk uses a microkernel plugin architecture. Plugins are discovered at runtime using Python entry points.
How plugins are discovered¶
Plugins register themselves under the aifred_tk.plugins entry point group in their
pyproject.toml:
The entry point value must be a factory function with this signature:
from dynaconf import Dynaconf
from aifred_tk.core.interfaces import Plugin
def create_plugin(settings: Dynaconf) -> Plugin: ...
Plugin lifecycle¶
- At startup the registry discovers all entry points in
aifred_tk.plugins - Each factory function is called with the active
Dynaconfsettings instance - The plugin's
get_tools()is called to collect all provided tools - Each tool is checked against settings for the
enabledflag (defaults totrue) - Enabled tools are registered and exposed via CLI and MCP
Failure isolation¶
A plugin that raises an exception during loading is logged as a warning and skipped. Other plugins continue to load normally.