strands.plugins.multiagent_registry
MultiAgentPlugin registry for managing plugins attached to a multi-agent orchestrator.
This module provides the _MultiAgentPluginRegistry class for tracking and managing plugins that have been initialized with an orchestrator instance.
_MultiAgentPluginRegistry
Section titled “_MultiAgentPluginRegistry”class _MultiAgentPluginRegistry()Defined in: src/strands/plugins/multiagent_registry.py:20
Registry for managing plugins attached to a multi-agent orchestrator.
The _MultiAgentPluginRegistry tracks plugins that have been initialized with an orchestrator, providing methods to add plugins and invoke their initialization.
The registry handles:
- Calling the plugin’s init_multi_agent() method for custom initialization
- Auto-registering discovered @hook decorated methods with the orchestrator
Example:
registry = _MultiAgentPluginRegistry(orchestrator)
class MyPlugin(MultiAgentPlugin): name = "my-plugin"
@hook def on_event(self, event: BeforeNodeCallEvent): pass # Auto-registered by registry
def init_multi_agent(self, orchestrator: MultiAgentBase) -> None: # Custom logic pass
plugin = MyPlugin()registry.add_and_init(plugin)__init__
Section titled “__init__”def __init__(orchestrator: "MultiAgentBase") -> NoneDefined in: src/strands/plugins/multiagent_registry.py:50
Initialize a plugin registry with an orchestrator reference.
Arguments:
orchestrator- The orchestrator instance that plugins will be initialized with.
add_and_init
Section titled “add_and_init”def add_and_init(plugin: MultiAgentPlugin) -> NoneDefined in: src/strands/plugins/multiagent_registry.py:67
Add and initialize a plugin with the orchestrator.
This method:
- Registers the plugin in the registry
- Calls the plugin’s init_multi_agent method for custom initialization
- Auto-registers all discovered @hook methods with the orchestrator’s hook registry
Handles both sync and async init_multi_agent implementations automatically.
Arguments:
plugin- The plugin to add and initialize.
Raises:
ValueError- If a plugin with the same name is already registered.