ref #6401 Adapt generics in agent base and others