The research concerning the control of multi-agent systems has grown rapidly over the past decade, attributed to their adaptiveness, efficiency, and robustness in dynamic environments. While multi-agent systems have a vast potential, safety, specifically obstacle avoidance, is indispensable when controlling such systems. In this paper, a control barrier function-based algorithm is employed to deal with obstacle avoidance problems. The computational load of the proposed algorithm remains constant even as the scale of multi-agent systems increases, making it highly compatible. Unlike conventional obstacle avoidance algorithms, the proposed algorithm guarantees a collision-free motion of agents. The feasibility of the proposed algorithm is verified under both simulations and experiments.