people-roofThe Plugin Manager

What is the Plugin Manager?

The Plugin Manager is the orchestrator of GL Plugin. It's the central coordinator that wires everything together—handlers, services, and plugins. While it powers the entire system, you interact with it through a simple interface.

The Plugin Manager's role: Mermaid Linkarrow-up-right

The Manager is responsible for:

  • Holding handlers that define plugin behavior

  • Storing global services shared across all plugins

  • Maintaining the Service Registry that resolves injections

  • Registering and retrieving plugins


Creating a Manager

Parameter
Description

handlers

List of handler instances that manage plugins

global_services

List of service instances available to all plugins


Registering Plugins

Use register_plugin() to add plugins to the manager:

When you register a plugin, the manager:

Plugin Registration Flow: Mermaid Linkarrow-up-right
  1. Identifies which handler the plugin belongs to (via @Plugin.for_handler())

  2. Collects services from the handler and global services

  3. Creates the plugin instance (__new__)

  4. Injects services into the instance

  5. Calls the handler's initialize_plugin() method

  6. Stores the plugin for later retrieval


Retrieving Plugins

By Name

Retrieve a specific plugin using its name attribute:

By Handler Type

Retrieve all plugins managed by a specific handler:

This is useful for:

  • Processing all plugins of a category

  • Polymorphic operations across related plugins

  • Plugin discovery and introspection


Manager Lifecycle

The Lifecycle Diagram for Plugin Manager: Mermaid Linkarrow-up-right

Complete Example


Summary

Method
Description

PluginManager(handlers, global_services)

Create manager with handlers and global services

register_plugin(PluginClass)

Register a plugin class

get_plugin(name)

Retrieve a plugin by its name

get_plugins(HandlerType)

Retrieve all plugins for a handler type

Last updated