Computer-implemented method for controlling a machine by means of a control agent, wherein a) a multiplicity of training data sets are read in and each specify, in a manner assigned to each other, a machine state, a control action and a subsequent state resulting from application of the control action to the machine state, b) for a multiplicity of the machine states in each case - a training action trajectory (TA T) starting from the respective machine state and specifying a chronological sequence of a plurality of control actions is determined on the basis of the training data sets, - an action trajectory (A T) starting from the respective machine state is predicted by means of the control agent on the basis of the respective machine state, and - a deviation of the predicted action trajectory (A T) from the training action trajectory (TA T) is determined, wherein the deviation is accumulated over a plurality of trajectory time steps, c) the control agent is trained to reduce the determined deviations at least on average, d) a performance evaluator is provided and determines, on the basis of a machine state and an action trajectory (A T), a trajectory performance value for controlling the machine by means of this action trajectory (A T), characterized in that e) to control the machine - a current operating state of the machine is recorded, - a multiplicity of test action trajectories starting from the recorded operating state are generated by means of the trained control agent, - for each of the test action trajectories, a trajectory performance value is determined by the performance evaluator, and - depending on the determined trajectory performance values, a performance-optimizing action trajectory is selected from the test action trajectories, and f) the machine is controlled on the basis of the selected action trajectory. a) a multiplicity of training data sets are read in and each specify, in a manner assigned to each other, a machine state, a control action and a subsequent state resulting from application of the control action to the machine state, b) for a multiplicity of the machine states in each case - a training action trajectory (TA T) starting from the respective machine state and specifying a chronological sequence of a plurality of control actions is determined on the basis of the training data sets, - an action trajectory (A T) starting from the respective machine state is predicted by means of the control agent on the basis of the respective machine state, and - a deviation of the predicted action trajectory (A T) from the training action trajectory (TA T) is determined, wherein the deviation is accumulated over a plurality of trajectory time steps, - a training action trajectory (TA T) starting from the respective machine state and specifying a chronological sequence of a plurality of control actions is determined on the basis of the training data sets, - an action trajectory (A T) starting from the respective machine state is predicted by means of the control agent on the basis of the respective machine state, and - a deviation of the predicted action trajectory (A T) from the training action trajectory (TA T) is determined, wherein the deviation is accumulated over a plurality of trajectory time steps, c) the control agent is trained to reduce the determined deviations at least on average, d) a performance evaluator is provided and determines, on the basis of a machine state and an action trajectory (A T), a trajectory performance value for controlling the machine by means of this action trajectory (A T), characterized in that e) to control the machine - a current operating state of the machine is recorded, - a multiplicity of test action trajectories starting from the recorded operating state are generated by means of the trained control agent, - for each of the test action trajectories, a trajectory performance value is determined by the performance evaluator, and - depending on the determined trajectory performance values, a performance-optimizing action trajectory is selected from the test action trajectories, and - a current operating state of the machine is recorded, - a multiplicity of test action trajectories starting from the recorded operating state are generated by means of the trained control agent, - for each of the test action trajectories, a trajectory performance value is determined by the performance evaluator, and - depending on the determined trajectory performance values, a performance-optimizing action trajectory is selected from the test action trajectories, and f) the machine is controlled on the basis of the selected action trajectory.