The enhancement for
MODULES-393 introduced a way to load JBoss Modules as an agent, the it would invoke an agents premain method after a few things are configuration. For example the log manager and the security manager.
While doing some testing I noticed that the Byteman agent uses the system class loader to load the transformer class. I'll acknowledge too that how modules is handling agents passed as module arguments is not quite to the spec it may be helpful if the Byteman agent could first check the entry points class loader and if null then use the system class loader.
I've created this as optional because I'm not too familiar with agents so maybe this is bad practice. Testing on WildFly showed this did work as expected. However I only ran a few tests not the full test suite with the changes.