Sorry didn’t read your question, so this is not an answer.
I don’t know how to automate this.
Hello,
In Beat Agent you can adjust the Start and End of a Sample.
Click edit and select the small s above the graphical reference of the sample.
There are two, one for the beginning and one for the ending.
These settings will be stored with your project when the project is saved.