class_docstr: Base class for all agents which contains the main API methods.
  
  Args:
      chat_prompt_template (`str`, *optional*):
          Pass along your own prompt if you want to override the default template for the `chat` method. Can be the
          actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
          `chat_prompt_template.txt` in this repo in this case.
      run_prompt_template (`str`, *optional*):
          Pass along your own prompt if you want to override the default template for the `run` method. Can be the
          actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
          `run_prompt_template.txt` in this repo in this case.
      additional_tools ([`Tool`], list of tools or dictionary with tool values, *optional*):
          Any additional tools to include on top of the default ones. If you pass along a tool with the same name as
          one of the default tools, that default tool will be overridden.
class_docstr_tok: ["Base","class","for","all","agents","which","contains","the","main","API","methods",".","Args",":","chat_prompt_template","(","`","str","`",",","*","optional","*",")",":","Pass","along","your","own","prompt","if","you","want","to","override","the","default","template","for","the","`","chat","`","method",".","Can","be","the","actual","prompt","template","or","a","repo","ID","(","on","the","Hugging","Face","Hub",")",".","The","prompt","should","be","in","a","file","named","`","chat_prompt_template.txt","`","in","this","repo","in","this","case",".","run_prompt_template","(","`","str","`",",","*","optional","*",")",":","Pass","along","your","own","prompt","if","you","want","to","override","the","default","template","for","the","`","run","`","method",".","Can","be","the","actual","prompt","template","or","a","repo","ID","(","on","the","Hugging","Face","Hub",")",".","The","prompt","should","be","in","a","file","named","`","run_prompt_template.txt","`","in","this","repo","in","this","case",".","additional_tools","(","[","`","Tool","`","]",",","list","of","tools","or","dictionary","with","tool","values",",","*","optional","*",")",":","Any","additional","tools","to","include","on","top","of","the","default","ones",".","If","you","pass","along","a","tool","with","the","same","name","as","one","of","the","default","tools",",","that","default","tool","will","be","overridden","."]
code: def __init__(
      self,
      chat_prompt_template=None,
      run_prompt_template=None,
      additional_tools=None,
  ):
      _setup_default_tools()
  
      agent_name = self.__class__.__name__
      self.chat_prompt_template = download_prompt(
          chat_prompt_template, agent_name, mode="chat"
      )
      self.run_prompt_template = download_prompt(
          run_prompt_template, agent_name, mode="run"
      )
      self._toolbox = HUGGINGFACE_DEFAULT_TOOLS.copy()
      self.log = print
      if additional_tools is not None:
          if isinstance(additional_tools, (list, tuple)):
              additional_tools = {t.name: t for t in additional_tools}
          elif not isinstance(additional_tools, dict):
              additional_tools = {
                  additional_tools.name: additional_tools
              }
  
          replacements = {
              name: tool
              for name, tool in additional_tools.items()
              if name in HUGGINGFACE_DEFAULT_TOOLS
          }
          self._toolbox.update(additional_tools)
          if len(replacements) > 1:
              names = "\n".join(
                  [f"- {n}: {t}" for n, t in replacements.items()]
              )
              logger.warning(
                  f"The following tools have been replaced by the ones provided in `additional_tools`:\n{names}."
              )
          elif len(replacements) == 1:
              name = list(replacements.keys())[0]
              logger.warning(
                  f"{name} has been replaced by {replacements[name]} as provided in `additional_tools`."
              )
  
      self.prepare_for_new_chat()
  
imports: import importlib.util
  import json
  import os
  import time
  from dataclasses import dataclass
  from typing import Dict
  import requests
  from huggingface_hub import HfFolder, hf_hub_download, list_spaces
  from ..models.auto import AutoTokenizer
  from ..utils import is_offline_mode, is_openai_available, is_torch_available, logging
  from .base import TASK_MAPPING, TOOL_CONFIG_FILE, Tool, load_tool, supports_remote
  from .prompts import CHAT_MESSAGE_PROMPT, download_prompt
  from .python_interpreter import evaluate
label_desc: Use image node_id 1 to create a new Agent object  with example: obj = Agent(chat_prompt_template, run_prompt_template, additional_tools)