Open christian-pinto opened 1 month ago
While discussing with @rherrell about enablenf an agent mode we realized that the main functionalities that would need to be forked for sunfish vs agent are:
In both cases, an agent implementation would need to augment the sunfish library by providing a new implementation of the required functionalities that the sunfish library can load dynamically. One thing I would like to avoid is having to hack the code of the library for every new agent coming with a new event handler or source forwarding interface.
I have explored ways of creating a plugin mechanisms in which the event handler and forwarding logic become plugins that can be installed at runtime by the agent. The way I expect this to work is the following:
pip install ....
) in their agent environmentWith the above process users would always use the latest version of the sunfish library without having to customize it for working as an agent.
A way of creating plugins in python that can be loaded from the agent into the sunfish library would be using namespace packages.
The agent reference will provide an example on how to load such plugins.
I will work on an example before introducing this change in the main library.
To support using the same library in server and agent mode I have implemented dynamically loadable plugins that can change the behaviour of the sunfish library without having to modify the core library.
In the specific, we now support event handlers, storage backends and redfish object handlers as loadable plugins. A description of how this is implemented included in the comments inside the codebase and in the description of PR #29 . I will also update the documentation accordingly.
With this functionality there is no need for a special agent mode but rather, aagents can provide their implementation handlers and storage backend as needed.
@rherrell
In the sunfish reference library enable/implement a subset of the API specific to Agents. This is to be used for implementing the core services that are required by agents without having to re-use (abuse) the entire sunfish core.