In order to solve the task allocation problem in a multi-agent system, namely RoboCup robot rescue simulation system (RCRSS), a task allocation mechanism based on auction is proposed. Using the mechanism, the agents can enter and leave the auction market flexibly and switch role dynamically. Meanwhile the anxiety degree is introduced to adjust the allocation scheme after the basic task allocation. As a result, rescue agents can adapt to dynamic disaster environments. Experimental results show that the rescue team using the proposed method is more suitable for different complex disaster environments than the rescue team using the genetic algorithm in terms of fulfilling the rescue tasks, reducing the task response delay and improving the efficiency of rescue system in a limit time.