To run the script from the command line without using Agisoft Metashape Professional GUI you need to use "-r" argument, like in the examples below (the path to the script should be either relative from the current dir or absolute, script arguments are optional):

On Windows:

metashape.exe -r <> [script arguments]

On Linux:

./ -r <> [script arguments]

On macOS:

/ -r <> [script arguments]

If the script is run on the non-GUI system, it may be necessary to use "-platform offscreen" additional argument, for example on Linux:

./ -r <> -platform offscreen