Change environment class attribute during training

Hello, I have a registered custom environment and an environment creation function I pass to the algorithm config during initialization, similar to:

config = PPOConfig().environment(env='MyEnv',env_config={'beta': 1}) algo =

MyEnv has the attribute “beta” which I would like to dynamically set during training (it changes how the rewards are calculated).

I have a loop over training epochs during which I run algo.train(). I’d like to change “beta” on all workers periodically, but not necessarily every epoch. How can I do this?


Update: it seems I can use algo.workers.foreach_env(lambda env: env.beta = 0.5)

For me, this answers the question.