We consider the problem of a collection of agents performing a shared task using interagent communication to coordinate their actions. We introduce a notion of consensus and use tools from graph theory and dynamical systems to relate the topology of the communication network to stability of the consensus protocol. Our formulation provides a separation principle between the dynamics of the individual agents and the topology of the information flow. Applications include cooperative estimation and control in mobile sensor networks. An unusual feature of this work is that it addresses consensus problems for networks with directed information flow.