Is "hist_stats" no longer supported?

1. Severity of the issue: (select one)
High: Completely blocks me.

2. Environment:

  • Ray version: 2.47.1
  • Python version: 3.11
  • OS: Linux

3. What happened vs. what you expected:

  • Expected: View single episode stats
  • Actual: KeyError

I would like to view single episode metrics. I searched on this forum and found several posts, all pointing to something like results[“hist_stats”] or results[“env_runners”][“hist_stats”].

https://discuss.ray.io/t/whats-different-between-episode-return-mean-of-each-iteration-and-episode-reward/15907
and
https://discuss.ray.io/t/constant-episode-reward-mean-over-training-even-setting-horizon-parameter/20868/4

However, this does not seem to work for me. What have I done wrong? Is “hist_stats” deprecated? If so, what is the current way of doing this?

I have set keep_per_episode_custom_metrics = True.

import gymnasium as gym
from ray.rllib.algorithms.sac import SACConfig

config = (
    SACConfig()
    .environment("Pendulum-v1")
    .env_runners(num_env_runners=1)
)
config.keep_per_episode_custom_metrics = True

algo = config.build_algo()
results = algo.train()

And then neither results[“env_runners”][“hist_stats”] nor results[“hist_stats”] exists.