Plugin protocol
Plugins are Python classes implementing BasePlugin. The framework
discovers them at startup from a registry list.
Class#
python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
PluginManifest#
python
1 2 3 4 5 6 7 8 9 10 | |
ToolDefinition#
python
1 2 3 4 5 6 7 8 | |
PluginPermission#
python
1 2 3 4 5 6 7 8 9 | |
PluginContext#
python
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Tool result conventions#
- Return a string. Markdown is fine. Empty string == "no result".
- For errors, return a friendly message ending with a "Fallback suggestions" line (the AI's tool-etiquette rule expects this shape).
Example:
python
1 2 3 4 5 | |
Registering#
Add to app/plugins/builtin/__init__.py:
python
1 2 3 4 5 6 | |
Restart the API; the plugin is discoverable in
GET /v1/admin/plugins. Enable it with:
bash
1 2 | |
Lifecycle hooks (optional)#
python
1 2 3 4 5 6 | |
Testing#
The db and tenant_context fixtures in tests/conftest.py give
you everything you need:
python
1 2 3 4 5 6 7 8 | |