Base

Base classes for the Arshai plugin system.

Classes

class arshai.extensions.base.Plugin(config=None)[source]

Bases: ABC

Base class for all Arshai plugins.

Plugins can extend various aspects of the framework: - Add new agent types - Add new tools - Add new LLM providers - Add new memory backends - Modify existing behavior through hooks

__init__(config=None)[source]

Initialize the plugin.

Parameters:

config (Optional[Dict[str, Any]]) – Plugin-specific configuration

abstractmethod get_metadata()[source]

Return plugin metadata.

Return type:

PluginMetadata

abstractmethod initialize()[source]

Initialize the plugin.

This method is called when the plugin is loaded. Use it to set up resources, register components, etc.

Return type:

None

abstractmethod shutdown()[source]

Shutdown the plugin.

This method is called when the plugin is unloaded. Use it to clean up resources.

Return type:

None

register_agent(name, agent_class)[source]

Register a new agent type. Override in subclasses.

Return type:

None

register_tool(tool_name, tool_function)[source]

Register a new tool function. Override in subclasses.

Return type:

None

register_llm_provider(name, llm_class)[source]

Register a new LLM provider. Override in subclasses.

Return type:

None

register_memory_provider(name, memory_class)[source]

Register a new memory provider. Override in subclasses.

Return type:

None

class arshai.extensions.base.PluginMetadata(name, version, author, description, requires=None, tags=None)[source]

Bases: object

Metadata for a plugin.

name: str
version: str
author: str
description: str
requires: List[str] = None
tags: List[str] = None
__init__(name, version, author, description, requires=None, tags=None)
class arshai.extensions.base.PluginRegistry[source]

Bases: object

Registry for managing loaded plugins.

__init__()[source]
register(plugin)[source]

Register a plugin.

Parameters:

plugin (Plugin) – The plugin instance to register

Return type:

None

unregister(name)[source]

Unregister a plugin.

Parameters:

name (str) – The name of the plugin to unregister

Return type:

None

get(name)[source]

Get a plugin by name.

Return type:

Optional[Plugin]

list_plugins()[source]

List all registered plugins.

Return type:

List[PluginMetadata]

find_by_tag(tag)[source]

Find plugins by tag.

Return type:

List[PluginMetadata]

Functions

arshai.extensions.base.get_plugin_registry()[source]

Get the global plugin registry.

Return type:

PluginRegistry