The emergence of Internet, Intranet, local area networks, and ad hoc wireless networks introduces a plethora of new problems in information processing. In order to overcome these problems, we combine the Grid and P2P technologies, and propose a dynamic hierarchical agentbased infrastructure. By dint of agents, we can not only overcome a lot of limitations of the mechanisms which Grid and P2P support for data management and interchange in large-scale dynamic distributed systems, but also provide a suitable paradigm for implementing systems that need to configure adaptively, and especially keep users’ information local to preserve individual privacy.