Advances in the development of technology have led to microrobots applications in medical elds. Drug delivery is one of these applications in which microrobots deliver a pharmaceutical compound to targeted cells. Chemotherapy and its side e®ects can then be minimized by this method. Two major constraints, however, must be considered: the robot's onboard energy supply and the time needed for drug delivery. Furthermore, a microrobot must avoid biological restricted areas which we treat as obstacles in the path. The main objectives of this work were tō nd optimal paths to targeted cells and avoid collision with obstacles in the paths under a dynamic environment. In this study, we controlled motion of microrobots based on the concept of swarm intelligence. Arti¯cial Bee Colony (ABC), the Best-so-far ABC, and the Particle Swarm Optimization (PSO) methods were employed to implement the collision detection and the boundary distance detection modules. Forces that drove or resisted blood°ow as well as pressure in blood vessels were considered to approximate the e®ects of the environment on the microrobots. Numerical experiments were conducted using various obstacle environments. The results con¯rm that the proposed approaches were successful in avoiding obstacles and optimizing the energy consumption used to reach the target.