code: def add_agent(self, overall_index=None, team_index=None):
          
          if overall_index is None:
              if not self.index_manager.has_free_slots():
                  return
              overall_index = self.index_manager.get_new_index()
          else:
              self.index_manager.use_index(overall_index)
          agent = GUIAgent(overall_index=overall_index)
          if team_index is not None:
              agent.set_team(team_index)
  
          self.agents.append(agent)
          self.overall_config.set_value(MATCH_CONFIGURATION_HEADER, PARTICIPANT_COUNT_KEY, len(self.agents))
          return agent
docs: Creates the agent using self.agent_class and adds it to the index manager.
          :param overall_index: The index of the bot in the config file if it already exists.
          :param team_index: The index of the team to place the agent in
          :return agent: an Agent (gui_agent) with either given index or a free one, returns None if there is no index given and all indices are occupied