class_docstr: Abstract base class for RLlib callbacks (similar to Keras callbacks).
  
  These callbacks can be used for custom metrics and custom postprocessing.
  
  By default, all of these callbacks are no-ops. To configure custom training
  callbacks, subclass DefaultCallbacks and then set
  {"callbacks": YourCallbacksClass} in the algo config.
class_docstr_tok: ["Abstract","base","class","for","RLlib","callbacks","(","similar","to","Keras","callbacks",")",".","These","callbacks","can","be","used","for","custom","metrics","and","custom","postprocessing",".","By","default",",","all","of","these","callbacks","are","no-ops",".","To","configure","custom","training","callbacks",",","subclass","DefaultCallbacks","and","then","set","{","``","callbacks","''",":","YourCallbacksClass","}","in","the","algo","config","."]
docstr: Called on each episode step (after the action has been logged).
  
  Note that on the new API stack, this callback is also called after the final
  step of an episode, meaning when terminated/truncated are returned as True
  from the `env.step()` call, but is still provided with the non-finalized
  episode object (meaning the data has NOT been converted to numpy arrays yet).
  
  The exact time of the call of this callback is after `env.step([action])` and
  also after the results of this step (observation, reward, terminated, truncated,
  infos) have been logged to the given `episode` object.
  
  Args:
      episode: The episode that has been stepped. On the new API stack, this will
          be a SingleAgentEpisode or MultiAgentEpisode object. On the old API
          stack, this will be a Episode or EpisodeV2 object.
      env_runner: Replaces `worker` arg. Reference to the current EnvRunner.
      env: Replaces `base_env` arg.  The gym.Env (new API stack) or RLlib
          BaseEnv (old API stack) running the episode. On the old stack, the
          underlying sub environment objects can be retrieved by calling
          `base_env.get_sub_environments()`.
      rl_module: Replaces `policies` arg. Either the RLModule (new API stack) or a
          dict mapping policy IDs to policy objects (old stack). In single agent
          mode there will only be a single policy/RLModule under the
          `rl_module["default_policy"]` key.
      env_index: The index of the sub-environment that is about to be reset
          (within the vector of sub-environments of the BaseEnv).
      kwargs: Forward compatibility placeholder.
docstr_tok: ["Called","on","each","episode","step","(","after","the","action","has","been","logged",")",".","Note","that","on","the","new","API","stack",",","this","callback","is","also","called","after","the","final","step","of","an","episode",",","meaning","when","terminated\/truncated","are","returned","as","True","from","the","`","env.step","(",")","`","call",",","but","is","still","provided","with","the","non-finalized","episode","object","(","meaning","the","data","has","NOT","been","converted","to","numpy","arrays","yet",")",".","The","exact","time","of","the","call","of","this","callback","is","after","`","env.step","(","[","action","]",")","`","and","also","after","the","results","of","this","step","(","observation",",","reward",",","terminated",",","truncated",",","infos",")","have","been","logged","to","the","given","`","episode","`","object",".","Args",":","episode",":","The","episode","that","has","been","stepped",".","On","the","new","API","stack",",","this","will","be","a","SingleAgentEpisode","or","MultiAgentEpisode","object",".","On","the","old","API","stack",",","this","will","be","a","Episode","or","EpisodeV2","object",".","env_runner",":","Replaces","`","worker","`","arg",".","Reference","to","the","current","EnvRunner",".","env",":","Replaces","`","base_env","`","arg",".","The","gym.Env","(","new","API","stack",")","or","RLlib","BaseEnv","(","old","API","stack",")","running","the","episode",".","On","the","old","stack",",","the","underlying","sub","environment","objects","can","be","retrieved","by","calling","`","base_env.get_sub_environments","(",")","`",".","rl_module",":","Replaces","`","policies","`","arg",".","Either","the","RLModule","(","new","API","stack",")","or","a","dict","mapping","policy","IDs","to","policy","objects","(","old","stack",")",".","In","single","agent","mode","there","will","only","be","a","single","policy\/RLModule","under","the","`","rl_module","[","``","default_policy","''","]","`","key",".","env_index",":","The","index","of","the","sub-environment","that","is","about","to","be","reset","(","within","the","vector","of","sub-environments","of","the","BaseEnv",")",".","kwargs",":","Forward","compatibility","placeholder","."]
code: def on_episode_step(
      self,
      *,
      # TODO (sven): Deprecate Episode/EpisodeV2 with new API stack.
      episode: Union[EpisodeType, Episode, EpisodeV2],
      # TODO (sven): Deprecate this arg new API stack (in favor of `env_runner`).
      worker: Optional["EnvRunner"] = None,
      env_runner: Optional["EnvRunner"] = None,
      # TODO (sven): Deprecate this arg new API stack (in favor of `env`).
      base_env: Optional[BaseEnv] = None,
      env: Optional[gym.Env] = None,
      # TODO (sven): Deprecate this arg new API stack (in favor of `rl_module`).
      policies: Optional[Dict[PolicyID, Policy]] = None,
      rl_module: Optional[RLModule] = None,
      env_index: int,
      **kwargs,
  ) -> None:
      """Called on each episode step (after the action has been logged).
  
      Note that on the new API stack, this callback is also called after the final
      step of an episode, meaning when terminated/truncated are returned as True
      from the `env.step()` call, but is still provided with the non-finalized
      episode object (meaning the data has NOT been converted to numpy arrays yet).
  
      The exact time of the call of this callback is after `env.step([action])` and
      also after the results of this step (observation, reward, terminated, truncated,
      infos) have been logged to the given `episode` object.
  
      Args:
          episode: The episode that has been stepped. On the new API stack, this will
              be a SingleAgentEpisode or MultiAgentEpisode object. On the old API
              stack, this will be a Episode or EpisodeV2 object.
          env_runner: Replaces `worker` arg. Reference to the current EnvRunner.
          env: Replaces `base_env` arg.  The gym.Env (new API stack) or RLlib
              BaseEnv (old API stack) running the episode. On the old stack, the
              underlying sub environment objects can be retrieved by calling
              `base_env.get_sub_environments()`.
          rl_module: Replaces `policies` arg. Either the RLModule (new API stack) or a
              dict mapping policy IDs to policy objects (old stack). In single agent
              mode there will only be a single policy/RLModule under the
              `rl_module["default_policy"]` key.
          env_index: The index of the sub-environment that is about to be reset
              (within the vector of sub-environments of the BaseEnv).
          kwargs: Forward compatibility placeholder.
      """
      pass
  
imports: import gc
  import os
  import platform
  import tracemalloc
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Type, Union
  import gymnasium
  import numpy
  from ray.rllib.core.rl_module.rl_module import RLModule
  from ray.rllib.env.base_env import BaseEnv
  from ray.rllib.env.env_context import EnvContext
  from ray.rllib.evaluation.episode import Episode
  from ray.rllib.evaluation.episode_v2 import EpisodeV2
  from ray.rllib.evaluation.postprocessing import Postprocessing
  from ray.rllib.policy import Policy
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.annotations import override, OverrideToImplementCustomLogic, PublicAPI
  from ray.rllib.utils.deprecation import deprecation_warning
  from ray.rllib.utils.exploration.random_encoder import _MovingMeanStd, compute_states_entropy, update_beta
  from ray.rllib.utils.typing import AgentID, EnvType, EpisodeType, PolicyID
  from ray.tune.callback import _CallbackMeta
  import psutil
label_desc: Use image node_id 10 for calling the DefaultCallbacks obj's underlying member method code with example usage: obj.on_episode_step() without return types