We present a solution to the problem of routing in a wireless sensor network based on Swarm Intelligence, which has been applied successfully to other routing problems, for example, the traveling salesman problem and others. Routing in a wireless sensor network can be understood as an optimization problem. In the solution presented, there are both source and destination node. The problem is focused on fi nding a path that allows optimally connecting both nodes. The search space is the complete set of possible paths that connect these two nodes. Two swarm algorithms were implemented for routing: ant-based algorithm, and bee-based algorithm. The results show that swarm intelligence improves the routing in a wireless sensor network when it is considering aspects such as the amount of energy available in the nodes. The simulations show that it produces an improvement in the lifetime of the network.1 Product derived of the research project: "Enrutamiento en redes de sensores inalámbricos usando algoritmos bioinspirados".