code: def _check_agent_id_bulk(self, payload):
      
      invalid_agent_indices = []
      valid_agent_indices = []
      invalid_payload = []
      for index, agent in enumerate(payload):
        # Check if the agent ID is valid
        try:
          if "id" in agent:
            self._check_agent_id(agent["id"])
        except CraftAiBadRequestError:
          invalid_agent_indices.append(index)
          invalid_payload.append({"id": agent["id"],
                                  "error": CraftAiBadRequestError(ERROR_ID_MESSAGE)})
        else:
          # Check if the agent is serializable
          try:
            json.dumps([agent])
          except TypeError as err:
            invalid_agent_indices.append(index)
            invalid_payload.append({"id": agent["id"],
                                    "error": err})
          else:
            valid_agent_indices.append(index)
  
      if len(invalid_agent_indices) == len(payload):
        raise CraftAiBadRequestError(ERROR_ID_MESSAGE)
  
      return valid_agent_indices, invalid_agent_indices, invalid_payload
docs: Checks that all the given agent ids are valid non-empty strings
      and if the agents are serializable.
  
      :param list payload: list of dictionnary which represents an agent.
  
      :return: list of the agents with valid ids, list of the agents with
      invalid ids, list of the dictionnaries with valid ids.
      :rtype: list, list, list of dict.
  
      :raise CraftAiBadRequestError: If all the agents are invalid.