This paper introduces a new formation framework for networked multiagent systems that can be used for obstacle avoidance. It is shown that the proposed framework minimizes a cost function while satisfying state and control constraints. Furthermore, agents converge to a formation such that the difference in the Laplacian potential of the constrained and desired formation is locally minimized. The proposed framework relies on an easily implementable local optimization process, whose computation load is independent on the network size. Therefore, the framework is scalable and decentralized. The proposed framework can be easily integrated into existing multiagent system guidance protocols in order to avoid obstacles. Several numerical examples are provided to demonstrate the efficacy of the proposed method.