Mobile agent routing planning problem for single task is analyzed, node energy consumption and time consumption are two main factors in the process of mobile agent migration. The constraint conditions and objective function model of mobile agent routing problem between nodes for single task are established. An improved Dijkstra algorithm is designed to solve this model. The simulation result shows that the proposed algorithm can get optimal mobile agent route between any two nodes in wireless sensor network according to current network environment.