docstr: Given the agents current knowledge, decide on the next action to apply to the environment
  
  :param action: An action to take, overriding whatever the current policy is
  :return: An ActionInfo object, which contains the action and any additional info from the action decision process
docstr_tok: ["Given","the","agents","current","knowledge",",","decide","on","the","next","action","to","apply","to","the","environment",":","param","action",":","An","action","to","take",",","overriding","whatever","the","current","policy","is",":","return",":","An","ActionInfo","object",",","which","contains","the","action","and","any","additional","info","from","the","action","decision","process"]
code: def act(self, action: Union[None, ActionType] = None) -> ActionInfo:
      """
      Given the agents current knowledge, decide on the next action to apply to the environment
  
      :param action: An action to take, overriding whatever the current policy is
      :return: An ActionInfo object, which contains the action and any additional info from the action decision process
      """
      if (
          self.phase == RunPhase.TRAIN
          and self.ap.algorithm.num_consecutive_playing_steps.num_steps
          == 0
      ):
          # This agent never plays  while training (e.g. behavioral cloning)
          return None
  
      # count steps (only when training or if we are in the evaluation worker)
      if (
          self.phase != RunPhase.TEST
          or self.ap.task_parameters.evaluate_only is not None
      ):
          self.total_steps_counter += 1
      self.current_episode_steps_counter += 1
  
      # decide on the action
      if action is None:
          if (
              self.phase == RunPhase.HEATUP
              and not self.ap.algorithm.heatup_using_network_decisions
          ):
              # random action
              action = self.spaces.action.sample_with_info()
          else:
              # informed action
              if self.pre_network_filter is not None:
                  # before choosing an action, first use the pre_network_filter to filter out the current state
                  update_filter_internal_state = (
                      self.ap.algorithm.update_pre_network_filters_state_on_inference
                      and self.phase is not RunPhase.TEST
                  )
                  curr_state = (
                      self.run_pre_network_filter_for_inference(
                          self.curr_state, update_filter_internal_state
                      )
                  )
  
              else:
                  curr_state = self.curr_state
              action = self.choose_action(curr_state)
              assert isinstance(action, ActionInfo)
  
      self.last_action_info = action
  
      # output filters are explicitly applied after recording self.last_action_info. This is
      # because the output filters may change the representation of the action so that the agent
      # can no longer use the transition in it's replay buffer. It is possible that these filters
      # could be moved to the environment instead, but they are here now for historical reasons.
      filtered_action_info = self.output_filter.filter(
          self.last_action_info
      )
  
      return filtered_action_info
  
imports: import copy
  import random
  from collections import OrderedDict
  from typing import Dict, List, Union, Tuple
  import numpy
  from six.moves import range
  from rl_coach.agents.agent_interface import AgentInterface
  from rl_coach.architectures.network_wrapper import NetworkWrapper
  from rl_coach.base_parameters import AgentParameters, Device, DeviceType, DistributedTaskParameters, Frameworks
  from rl_coach.core_types import RunPhase, PredictionType, EnvironmentEpisodes, ActionType, Batch, Episode, StateType
  from rl_coach.core_types import Transition, ActionInfo, TrainingSteps, EnvironmentSteps, EnvResponse
  from rl_coach.logger import screen, Logger, EpisodeLogger
  from rl_coach.memories.episodic.episodic_experience_replay import EpisodicExperienceReplay
  from rl_coach.saver import SaverCollection
  from rl_coach.spaces import SpacesDefinition, VectorObservationSpace, GoalsSpace, AttentionActionSpace
  from rl_coach.utils import Signal, force_list
  from rl_coach.utils import dynamic_import_and_instantiate_module_from_params
  from rl_coach.memories.backend.memory_impl import get_memory_backend
  from rl_coach.core_types import TimeTypes
  from rl_coach.off_policy_evaluators.ope_manager import OpeManager
  from rl_coach.core_types import PickledReplayBuffer, CsvDataset
label_desc: Use image node_id 28 for calling the Agent obj's underlying member method code with example usage: obj.act(action) and returns: filtered_action_info, None