class_docstr: REST client to interact with an RLlib policy server.
docstr: Create a PolicyClient instance.
  
  Args:
      address: Server to connect to (e.g., "localhost:9090").
      inference_mode: Whether to use 'local' or 'remote' policy
          inference for computing actions.
      update_interval (float or None): If using 'local' inference mode,
          the policy is refreshed after this many seconds have passed,
          or None for manual control via client.
      session (requests.Session or None): If available the session object
          is used to communicate with the policy server. Using a session
          can lead to speedups as connections are reused. It is the
          responsibility of the creator of the session to close it.
docstr_tok: ["Create","a","PolicyClient","instance",".","Args",":","address",":","Server","to","connect","to","(","e.g.",",","``","localhost:9090","''",")",".","inference_mode",":","Whether","to","use","'local","'","or","'remote","'","policy","inference","for","computing","actions",".","update_interval","(","float","or","None",")",":","If","using","'local","'","inference","mode",",","the","policy","is","refreshed","after","this","many","seconds","have","passed",",","or","None","for","manual","control","via","client",".","session","(","requests.Session","or","None",")",":","If","available","the","session","object","is","used","to","communicate","with","the","policy","server",".","Using","a","session","can","lead","to","speedups","as","connections","are","reused",".","It","is","the","responsibility","of","the","creator","of","the","session","to","close","it","."]
code: def __init__(
      self,
      address: str,
      inference_mode: str = "local",
      update_interval: float = 10.0,
      session: Optional[requests.Session] = None,
  ):
      """Create a PolicyClient instance.
  
      Args:
          address: Server to connect to (e.g., "localhost:9090").
          inference_mode: Whether to use 'local' or 'remote' policy
              inference for computing actions.
          update_interval (float or None): If using 'local' inference mode,
              the policy is refreshed after this many seconds have passed,
              or None for manual control via client.
          session (requests.Session or None): If available the session object
              is used to communicate with the policy server. Using a session
              can lead to speedups as connections are reused. It is the
              responsibility of the creator of the session to close it.
      """
      self.address = address
      self.session = session
      self.env: ExternalEnv = None
      if inference_mode == "local":
          self.local = True
          self._setup_local_rollout_worker(update_interval)
      elif inference_mode == "remote":
          self.local = False
      else:
          raise ValueError(
              "inference_mode must be either 'local' or 'remote'"
          )
  
imports: import logging
  import threading
  import time
  from typing import Union, Optional
  from enum import Enum
  import ray.cloudpickle
  from ray.rllib.env.external_env import ExternalEnv
  from ray.rllib.env.external_multi_agent_env import ExternalMultiAgentEnv
  from ray.rllib.env.multi_agent_env import MultiAgentEnv
  from ray.rllib.policy.sample_batch import MultiAgentBatch
  from ray.rllib.utils.annotations import PublicAPI
  from ray.rllib.utils.typing import MultiAgentDict, EnvInfoDict, EnvObsType, EnvActionType
label_desc: Use image node_id 1 to create a new PolicyClient object  with example: obj = PolicyClient(address, inference_mode, update_interval, session)