Using custom labels

using the io.rancher.container.create_agent label rancher goes and “does stuff” to populate an environment variable in the container

Can I implement my own routines / custom labels in this manner ? I would also like to “do some stuff” (for example, generate a single-use token) when a container / environment starts up

No, at least short of forking Cattle.