docstr: The Agent orchestrates the interactions on our RL components, given
  the interactions with the environment.
  
  Args:
      policy: Policy that acts given preprocessed input
      action_preprocessor: preprocesses action for environment
      post_step: called after env.step(action).
          Default post_step is to do nothing.
docstr_tok: ["The","Agent","orchestrates","the","interactions","on","our","RL","components",",","given","the","interactions","with","the","environment",".","Args",":","policy",":","Policy","that","acts","given","preprocessed","input","action_preprocessor",":","preprocesses","action","for","environment","post_step",":","called","after","env.step","(","action",")",".","Default","post_step","is","to","do","nothing","."]
code: def __init__(
      self,
      policy: Policy,
      post_transition_callback: Optional[PostStep] = None,
      post_episode_callback: Optional[PostEpisode] = None,
      obs_preprocessor=_id,
      action_extractor=_id,
      device: Optional[torch.device] = None,
  ) -> None:
      """
      The Agent orchestrates the interactions on our RL components, given
      the interactions with the environment.
  
      Args:
          policy: Policy that acts given preprocessed input
          action_preprocessor: preprocesses action for environment
          post_step: called after env.step(action).
              Default post_step is to do nothing.
      """
      device = device or torch.device("cpu")
      self.policy = policy
      self.obs_preprocessor = obs_preprocessor
      self.action_extractor = action_extractor
      self.post_transition_callback = post_transition_callback
      self.post_episode_callback = post_episode_callback
      self.device = device
  
file_path: ReAgent/reagent/gym/agents/agent.py
imports: from typing import Any, Dict, Optional, Tuple, Union
  import numpy
  import torch
  from reagent.gym.envs.env_wrapper import EnvWrapper
  from reagent.gym.policies.policy import Policy
  from reagent.gym.policies.random_policies import make_random_policy_for_env
  from reagent.gym.types import PostEpisode, PostStep, Trajectory, Transition
label_desc: Use image node_id 1 to create a new Agent object  with example: obj = Agent(policy, post_transition_callback, post_episode_callback, obs_preprocessor, action_extractor, device)