Create as needed. (Eventually this will be part of a "registration" process, and handle during installation)
Persist in an .ini style file somewhere predictable. (Preferably globally.)
Allow the GUID to be passed in via API. (So that the Splunk TA version can simply pass in Splunk's instance GUID; as a persistence path is not easily available.)
Create and store a unique GUID per agent:
.ini
style file somewhere predictable. (Preferably globally.)