In this paper, the optimal incremental-containment control of two-order swarm system based on reinforcement learning (RL) is proposed to avoid the dilemma that the number of agents in a swarm system is immutable, which is essential for a swarm system that cannot meet the containment demands and need more agents to expand the containment range. Notably, the number of agents in a swarm system with a traditional containment controller is immutable, which limits the containment range that the swarm system can achieve. Besides, in traditional optimal control theory, it is obtained by solving the Hamilton-Jacobi-Bellman (HJB) equation, which is difficult to solve due to the unknown nonlinearity. To overcome these problems, several contributions are made in this paper. Firstly, in order to overcome the dilemma that the number of agents in the swarm system is immutable, the incremental-containment control is proposed. Secondly, considering the error and control input as the optimization goal, the optimal cost function is introduced and the optimal incremental-containment control is proposed to reduce resource waste and increase hardware service life. Furthermore, based on the proposed optimal incrementalcontainment control, the controller is designed by a new RL based on the backstepping method. The Lyapunov function is used to prove the stability of controller. The simulation show the efficiency of the proposed controller.