Plugin Module In ZERDA

On this page

The plugins module (import path: zerda.plugins) gives you a single, coherent module for building, discovering, securing, and orchestrating plugins that an LLM agent can call as tools — retrievers, external APIs, mutating actions, and data-processing steps.

Python · 16 lines
from zerda.plugins import PluginManager, PluginMetadata, SchemaProperty
from zerda.plugins import RetrievalPlugin, ToolPlugin

manager = PluginManager(plugin_dirs=["./my_plugins"])
await manager.startup()

# Execute a plugin directly
result = await manager.execute("web_search", {"query": "RAG 2025"}, context)

# Let the AI selector pick the best plugin
plugin = manager.select_one("find recent papers on LLMs")
result = await manager.execute(plugin.name, {"query": "..."}, context)

# Get LLM tool descriptors
tools = manager.tool_descriptors()   # OpenAI format
tools = manager.anthropic_tools()    # Anthropic format

This example is reproduced verbatim from the package docstring in plugins/__init__.

What's in the box

SubsystemModuleResponsibility
Plugin contractbase_pluginAbstract base class every plugin implements; stats, retries, timeouts, caching
Metadata & schemasmetadataAI-queryable plugin metadata, JSON-Schema properties, execution context, enums
Plugin typestypesFour canonical plugin archetypes: Retrieval, Tool, Action, Processing
RegistryregistryIn-memory catalog with keyword search and LLM tool-descriptor export
LoaderloaderFilesystem discovery, dynamic import, lazy loading, hot-reload file tracking
Managerplugin_managerOrchestration façade: lifecycle, execution, AI selection, hooks, observability
SecuritysecurityPermission guard, input sanitizer, execution sandbox
Hot reloadhot_reloadBackground file-watcher (watchdog or polling) that triggers live reloads

Where to go next