The example way of setting the preferred agent configuration uses a function call to create the value. However, the variable is created using defcustom. If you try to set it using that interface, there is no easy way to do it.
The way i imagine this would be just to get the identifier for the config, for example gemini-cli.