Resource allocation in the Internet of Things (IoT) applications for Wireless Sensor Networks (WSNs) is a challenging problem that requires tasks processing from the appropriate sensor nodes without compromising the Quality-of-Service (QoS). Due to heterogeneity in sensors, the inter-cluster and intra-cluster cooperative communication between sensor nodes hinders the overall resource allocation of the network in terms of energy consumption and response time. Therefore, this paper establishes a multi-agent clustering WSN model, i.e., Adaptive Distributed Artificial Intelligence (ADAI) technique with a hierarchical resource allocation strategy to address the issue of resource allocation in these types of network. For the inter-cluster power allocation, we are considering QoS and energy consumption factors with DAI. Moreover, for intra-cluster resource allocation, this paper introduces Adaptive Particle Swarm Optimization (APSO), which uses its objective functions as the node distance and respective energy loads. The mathematical analysis and simulation results validate the propose method in terms of energy consumption and response time of the network.