Skip to content

strands.plugins.registry

Plugin registry for managing plugins attached to an agent.

This module provides the _PluginRegistry class for tracking and managing plugins that have been initialized with an agent instance.

class _PluginRegistry()

Defined in: src/strands/plugins/registry.py:21

Registry for managing plugins attached to an agent.

The _PluginRegistry tracks plugins that have been initialized with an agent, providing methods to add plugins and invoke their initialization.

Example:

registry = _PluginRegistry(agent)
class MyPlugin(Plugin):
name = "my-plugin"
def init_plugin(self, agent: Agent) -> None:
pass
plugin = MyPlugin()
registry.add_and_init(plugin)
def __init__(agent: "Agent") -> None

Defined in: src/strands/plugins/registry.py:42

Initialize a plugin registry with an agent reference.

Arguments:

  • agent - The agent instance that plugins will be initialized with.
def add_and_init(plugin: Plugin) -> None

Defined in: src/strands/plugins/registry.py:51

Add and initialize a plugin with the agent.

This method registers the plugin and calls its init_plugin method. Handles both sync and async init_plugin implementations automatically.

Arguments:

  • plugin - The plugin to add and initialize.

Raises:

  • ValueError - If a plugin with the same name is already registered.