In most literatures on the consensus of multi-agent system (MAS), the agents considered are time-invariant. However in many cases (e.g. aerocrafts), the dynamics of agents have the characteristic of switching. Moreover, such switching in agent might be accompanied with the change of the interconnection topology of this MAS. This paper proposes a new model of two level switching structure to describe this type of MAS. The switching in the low level, which represents the variation of the agent dynamics, is deterministic and controllable. The switching in the upper level, which reflects the random change of the topology, fits for a Markov chain. Besides, the transition probability of the Markov chain in the upper level varies accordingly with the low level switching. This paper deals with the almost sure (AS) consensus for the MAS with two level switching. By analyzing the transient features of discrete-time Markov chain and based on the method of dwell time, a sufficient condition of AS consensus is proposed.