What problem does it solve?
Enables developers to extend Renfield by registering asynchronous callbacks at well-defined lifecycle and message insertion points so external packages can inject context, post-process messages, add API routes, or register agent tools without modifying core code.
Core Features & Use Cases
- Async Hook Registration: Register async callbacks for events like startup, shutdown, register_routes, register_tools, post_message, post_document_ingest, and retrieve_context.
- Context Injection & Post-Processing: Inject additional LLM context during retrieval and run fire-and-forget post-processing for analytics, knowledge extraction, or moderation.
- Agent & API Extensions: Add custom agent tools to the Agent Loop and mount additional FastAPI routers for plugin functionality.
- Use Case: Implement a plugin that extracts entities from every chat exchange, supplies context from an external knowledge graph, and registers a custom agent tool to act on user intents.
Quick Start
Create an async register() that calls register_hook for the events you need and set the PLUGIN_MODULE environment variable to my_plugin.hooks:register so Renfield loads your plugin at startup.