A computer implemented method for designing a quantum control trajectory for implementing a quantum gate using quantum hardware comprising one or more qubits and a quantum system, the method comprising: representing the quantum gate as a sequence of control actions; applying a reinforcement learning model to iteratively adjust each control action in the sequence of control actions to determine a quantum control trajectory that implements the quantum gate and reduces leakage, infidelity and total runtime of the quantum gate during the iterative adjustments, wherein the leakage comprises leakage from a computational subspace to a non-computational subspace, the applying comprising, for each iteration: determining , by an agent , a control action for the iteration based on a current state of the quantum system included in the quantum hardware; updating , by a training environment , the current state of the quantum system to a subsequent state of the quantum system using the determined control action and sample control noise; determining , by the agent, a discounted future reward using i) a universal control cost function that penalizes leakage, infidelity and total gate runtime as a reinforcement learning discounted future reward function and ii) the updated state of the quantum system, wherein the universal control cost function comprises a leakage penalty term, an infidelity penalty term and a total runtime penalty term; and adjusting , by the agent and based on the determined discounted future reward, values of one or more control trajectory parameters for the iteration. representing the quantum gate as a sequence of control actions; applying a reinforcement learning model to iteratively adjust each control action in the sequence of control actions to determine a quantum control trajectory that implements the quantum gate and reduces leakage, infidelity and total runtime of the quantum gate during the iterative adjustments, wherein the leakage comprises leakage from a computational subspace to a non-computational subspace, the applying comprising, for each iteration: determining , by an agent , a control action for the iteration based on a current state of the quantum system included in the quantum hardware; updating , by a training environment , the current state of the quantum system to a subsequent state of the quantum system using the determined control action and sample control noise; determining , by the agent, a discounted future reward using i) a universal control cost function that penalizes leakage, infidelity and total gate runtime as a reinforcement learning discounted future reward function and ii) the updated state of the quantum system, wherein the universal control cost function comprises a leakage penalty term, an infidelity penalty term and a total runtime penalty term; and adjusting , by the agent and based on the determined discounted future reward, values of one or more control trajectory parameters for the iteration. determining , by an agent , a control action for the iteration based on a current state of the quantum system included in the quantum hardware; updating , by a training environment , the current state of the quantum system to a subsequent state of the quantum system using the determined control action and sample control noise; determining , by the agent, a discounted future reward using i) a universal control cost function that penalizes leakage, infidelity and total gate runtime as a reinforcement learning discounted future reward function and ii) the updated state of the quantum system, wherein the universal control cost function comprises a leakage penalty term, an infidelity penalty term and a total runtime penalty term; and adjusting , by the agent and based on the determined discounted future reward, values of one or more control trajectory parameters for the iteration. <EOS>