Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/plugins/system.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# PLUGIN SYSTEM FOR AGENT TOOL USAGE
# Flexible plugin architecture with hot-reload support

import absc
from typing import Any, Callable, List, Dict

class PluginInterface(abc.ABC):
"Base interface for all plugins"
@abc.abstractmethod
def get_name(self) -> str:
pass

@abc.abstractmethod
def execute(self, *args, **kwargs) -> Any:
pass

class PluginManager:
def __init__(self):
self.plugins = {}
self.plugin_paths = []

def register_plugin(self, plugin: PluginInterface) -> None:
"Register a plugin for use in agent actions"
self.plugins[plugin.get_name()] = plugin

def hot_reload(self, plugin_name: str) -> None:
"Reload a specific plugin without restarting the agent"
if plugin_name in self.plugins:
del self.plugins[plugin_name]
# Reimport the plugin module

def get_plugin(self, name: str) -> PluginInterface:
return self.plugins.get(name)