A wide variety of laser applications, that often require radiation with specific characteristics, and relative flexibility of laser configurations offer a prospect of designing systems with the parameters on demand. The inverse laser design problem is to find the system architecture that provides for the generation of the desired laser output. However, typically, such inverse problems for nonlinear systems are sensitive to the computation of the gradients of a target (fitness) function making direct back propagation approach challenging. We apply here particle swarm optimization algorithm that does not rely on the gradients of the fitness function to the design of a fiber 8-figure laser cavity. This technique allows us to determine the laser cavity architectures tailored to generating on demand pulses with duration in the range of 1.5–105 ps and spectral width in the interval 0.1–20.5 nm. The proposed design optimisation algorithm can be applied to a variety of laser applications, and, more generally, in a range of engineering systems with flexible adjustable configurations and the outputs on demand.