The distributed nature of peer-to-peer networks offers a solid ground for the deployment of environments where multiple agents, managing several resources, can cooperate in pursuing common and individual goals while achieving good overall performance. In this article we present a survey of recent work on the integration of multi-agent systems and peer-to-peer computing for resource coordination (including discovery, composition and execution of resources) and we propose an approach for optimizing resource coordination through the use of efficient peer-to-peer search mechanisms relying upon a powerful semantic overlay network. We also present an approach for the dynamic development of the required semantic overlay network from a network of randomly-connected peers.