PunySquid88 you can also run xvfb directly from python https://pypi.org/project/xvfbwrapper/ . We have been using it this way.
Hi PunySquid88 , you can do that by running trains-agent using the same xvfb-run
command, for example xvfb-run -s "-screen 0 1400x900x24" trains-agent daemon ...
When this trains-agent instance will start running an experiment in a python virtualenv, all environment variable will be visible to your experiment code...