class_docstr: Image type returned by the agent. Behaves as a PIL.Image.
class_docstr_tok: ["Image","type","returned","by","the","agent",".","Behaves","as","a","PIL.Image","."]
docstr: Returns the stringified version of that object. In the case of an AgentImage, it is a path to the serialized
  version of the image.
docstr_tok: ["Returns","the","stringified","version","of","that","object",".","In","the","case","of","an","AgentImage",",","it","is","a","path","to","the","serialized","version","of","the","image","."]
code: def to_string(self):
      """
      Returns the stringified version of that object. In the case of an AgentImage, it is a path to the serialized
      version of the image.
      """
      if self._path is not None:
          return self._path
  
      if self._raw is not None:
          directory = tempfile.mkdtemp()
          self._path = os.path.join(
              directory, str(uuid.uuid4()) + ".png"
          )
          self._raw.save(self._path)
  
          return self._path
  
      if self._tensor is not None:
          array = self._tensor.cpu().detach().numpy()
  
          # There is likely simpler than load into image into save
          img = Image.fromarray((array * 255).astype(np.uint8))
  
          directory = tempfile.mkdtemp()
          self._path = os.path.join(
              directory, str(uuid.uuid4()) + ".png"
          )
  
          img.save(self._path)
  
          return self._path
  
imports: import os
  import pathlib
  import tempfile
  import uuid
  import numpy
  from ..utils import is_soundfile_availble, is_torch_available, is_vision_available, logging
label_desc: Use image node_id 4 for calling the AgentImage obj's underlying member method code with example usage: obj.to_string() and returns: self, self, self