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: Callback run right after an Episode has started.
  
  This method gets called after a new Episode(V2) (old stack) or
  SingleAgentEpisode/MultiAgentEpisode instance has been reset via the
  `env.reset()` API by RLlib.
  
  1) Episode(V2)/Single-/MultiAgentEpisode created: on_episode_created is called.
  2) Respective sub-environment (gym.Env) is `reset()`.
  3) Episode(V2)/Single-/MultiAgentEpisode starts: This callback is called.
  4) Stepping through sub-environment/episode commences.
  
  Args:
      episode: The just started episode (after `env.reset()`). 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: ["Callback","run","right","after","an","Episode","has","started",".","This","method","gets","called","after","a","new","Episode","(","V2",")","(","old","stack",")","or","SingleAgentEpisode\/MultiAgentEpisode","instance","has","been","reset","via","the","`","env.reset","(",")","`","API","by","RLlib",".","1",")","Episode","(","V2",")","\/Single-\/MultiAgentEpisode","created",":","on_episode_created","is","called",".","2",")","Respective","sub-environment","(","gym.Env",")","is","`","reset","(",")","`",".","3",")","Episode","(","V2",")","\/Single-\/MultiAgentEpisode","starts",":","This","callback","is","called",".","4",")","Stepping","through","sub-environment\/episode","commences",".","Args",":","episode",":","The","just","started","episode","(","after","`","env.reset","(",")","`",")",".","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_start(
      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:
      """Callback run right after an Episode has started.
  
      This method gets called after a new Episode(V2) (old stack) or
      SingleAgentEpisode/MultiAgentEpisode instance has been reset via the
      `env.reset()` API by RLlib.
  
      1) Episode(V2)/Single-/MultiAgentEpisode created: on_episode_created is called.
      2) Respective sub-environment (gym.Env) is `reset()`.
      3) Episode(V2)/Single-/MultiAgentEpisode starts: This callback is called.
      4) Stepping through sub-environment/episode commences.
  
      Args:
          episode: The just started episode (after `env.reset()`). 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 9 for calling the DefaultCallbacks obj's underlying member method code with example usage: obj.on_episode_start() without return types