code: import os
  import time
  from dotenv import load_dotenv
  from llama_index.agent import ReActAgent
  from llama_index.tools import FunctionTool
  from llama_index.callbacks import LlamaDebugHandler, CallbackManager
  import subprocess
  
  from tools.llm import MYLLM
  from tools.tools import MYTOOLBOX
  
  load_dotenv()
  
  
  debug_mode = True
  llama_debug = LlamaDebugHandler(print_trace_on_end=debug_mode)
  callback_manager = None
  
  if debug_mode:
      callback_manager = CallbackManager(handlers=[llama_debug])
  
  
  # time.sleep(3)
  llm = None
  # llm_model = "LOCAL_LAMA2CPP"
  
  
  if __name__ == "__main__":
      print("**** Hello Agents with Llamaindex ****")
      # llm = MYLLM.get_llm_model()
      llm = MYLLM.get_llm_model("LOCAL_LAMA2CPP", "default", 0.7)
  
      tool1 = FunctionTool.from_defaults(fn=MYTOOLBOX.write_haiku, name="Write Haiku")
      tool2 = FunctionTool.from_defaults(
          fn=MYTOOLBOX.count_characters, name="Count Characters"
      )
      tool3 = FunctionTool.from_defaults(
          fn=MYTOOLBOX.open_application, name="Open Application"
      )
      tool4 = FunctionTool.from_defaults(fn=MYTOOLBOX.open_url, name="Open URL")
      tools_list = [tool1, tool2, tool3, tool4]
  
      agent = ReActAgent.from_tools(
          tools=tools_list, llm=llm, verbose=True, callback_manager=callback_manager
      )
      res = agent.query(
          "Write me a haiku about fennec and then count the characters in it"
      )
      # res = agent.query("Open Obsidian ain my computer")
      # res = agent.query("Open the URL https://www.youtube.com/watch?v=cWc7vYjgnTs in my firefox browser")
  
      print(res)
  
      response = llm.complete("Hello! Can you tell me a poem about cats and dogs?")
      print(response.text)
  
      pass
  
apis: llama_index.tools.FunctionTool.from_defaults llama_index.callbacks.LlamaDebugHandler llama_index.agent.ReActAgent.from_tools llama_index.callbacks.CallbackManager
extract_api: [((288, 301), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (299, 301), False, 'from dotenv import load_dotenv\n'), ((336, 384), 'llama_index.callbacks.LlamaDebugHandler', 'LlamaDebugHandler', ([], {'print_trace_on_end': 'debug_mode'}), '(print_trace_on_end=debug_mode)\n', (353, 384), False, 'from llama_index.callbacks import LlamaDebugHandler, CallbackManager\n'), ((448, 487), 'llama_index.callbacks.CallbackManager', 'CallbackManager', ([], {'handlers': '[llama_debug]'}), '(handlers=[llama_debug])\n', (463, 487), False, 'from llama_index.callbacks import LlamaDebugHandler, CallbackManager\n'), ((673, 726), 'tools.llm.MYLLM.get_llm_model', 'MYLLM.get_llm_model', (['"""LOCAL_LAMA2CPP"""', '"""default"""', '(0.7)'], {}), "('LOCAL_LAMA2CPP', 'default', 0.7)\n", (692, 726), False, 'from tools.llm import MYLLM\n'), ((740, 812), 'llama_index.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'MYTOOLBOX.write_haiku', 'name': '"""Write Haiku"""'}), "(fn=MYTOOLBOX.write_haiku, name='Write Haiku')\n", (766, 812), False, 'from llama_index.tools import FunctionTool\n'), ((825, 912), 'llama_index.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'MYTOOLBOX.count_characters', 'name': '"""Count Characters"""'}), "(fn=MYTOOLBOX.count_characters, name=\n    'Count Characters')\n", (851, 912), False, 'from llama_index.tools import FunctionTool\n'), ((934, 1021), 'llama_index.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'MYTOOLBOX.open_application', 'name': '"""Open Application"""'}), "(fn=MYTOOLBOX.open_application, name=\n    'Open Application')\n", (960, 1021), False, 'from llama_index.tools import FunctionTool\n'), ((1043, 1109), 'llama_index.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'MYTOOLBOX.open_url', 'name': '"""Open URL"""'}), "(fn=MYTOOLBOX.open_url, name='Open URL')\n", (1069, 1109), False, 'from llama_index.tools import FunctionTool\n'), ((1169, 1270), 'llama_index.agent.ReActAgent.from_tools', 'ReActAgent.from_tools', ([], {'tools': 'tools_list', 'llm': 'llm', 'verbose': '(True)', 'callback_manager': 'callback_manager'}), '(tools=tools_list, llm=llm, verbose=True,\n    callback_manager=callback_manager)\n', (1190, 1270), False, 'from llama_index.agent import ReActAgent\n')]