I gave my PC to an agency which repairs computers. I remember that my computer had 8GB of RAM and when get back my computer has 4GB of RAM
Is it possible to retrieve a history on the size of the RAM over time?
There is no guaranteed, universal way to do this and no standardized system log of component history, although as @Giacomo1968 has stated systems often leave hints behind in logs and the like.
A few OEM's (I particularly like Dell and their service tag system) come with a unique identifier or model variant that can be used to look at the state of the hardware as shipped by the manufacturer.