In order to execute the script automatically when Agisoft Metashape Professional instance is run you need to place Python script to the following folder:
on Mac OS X:
/Users/<username>/Library/Application Support/Agisoft/Metashape Pro/scripts/
on any OS (for all users):
Usually such autorun scripts are useful for adding custom menu options to call the custom processing operations directly from the application GUI instead of using Run Script dialog each time.