Recording user actions from Python

Hi, my goal is the following. I want to record user actions exactly as with UI.Vision RPA as the output is perfect, but I want to do it from Python, meaning that the browser is opened programatically, recording started and after the recording is stopped, let’s say on browser close, the user event/actions performed information is returned and I can use it to perform additional processing.

Is there a way to do this using UI.Vision RPA, what is the closest I can get?

Ui.Vision is a browser extension - that is why it can record these events. An outside Python script can not do it.