EnvRunnerGroup.foreach_env(func: Callable[[Any | gymnasium.Env], List[T]]) List[List[T]][source]#

Calls func with all workers’ sub-environments as args.

An “underlying sub environment” is a single clone of an env within a vectorized environment. func takes a single underlying sub environment as arg, e.g. a gym.Env object.


func – A function - taking an EnvType (normally a gym.Env object) as arg and returning a list of lists of return values, one value per underlying sub-environment per each worker.


The list (workers) of lists (sub environments) of results.

DeveloperAPI: This API may change across minor Ray releases.