code: def make_agent_from_hparams(
      agent_type, base_env, stacked_env, loop_hparams, policy_hparams,
      planner_hparams, model_dir, policy_dir, sampling_temp, video_writers=()
  ):
    
    def sim_env_kwargs_fn():
      return rl.make_simulated_env_kwargs(
          base_env, loop_hparams, batch_size=planner_hparams.batch_size,
          model_dir=model_dir
      )
    planner_kwargs = planner_hparams.values()
    planner_kwargs.pop("batch_size")
    planner_kwargs.pop("rollout_agent_type")
    planner_kwargs.pop("env_type")
    return make_agent(
        agent_type, stacked_env, policy_hparams, policy_dir, sampling_temp,
        sim_env_kwargs_fn, loop_hparams.frame_stack_size,
        planner_hparams.rollout_agent_type,
        inner_batch_size=planner_hparams.batch_size,
        env_type=planner_hparams.env_type,
        video_writers=video_writers, **planner_kwargs
    )
docs: Creates an Agent from hparams.