The cooperative task processing and resource management among autonomous and heterogeneous spatial database systems in a grid environment is a challenge work. In this paper, we propose a BDI agent framework to process spatial query and dynamically manage resource in a grid environment. The BDI rational engine and the FIPA Contract Net Interaction Protocol can help spatial query agents to dynamically select the optimum spatial resource agents to execute spatial query efficiently. Theme agents can learn the history records of resource which were visited in the past period, and then make a strategy of adjusting the distribution of spatial resource. Theme agents will call the proper resource agents to take the actual action to adjusting the spatial resource.