in reply to Using module in object

Is it a sane approach to add $agent as a property to the object?

Yes.