  Optimizing the injection process in particle accelerators is crucial for
enhancing beam quality and operational efficiency. This paper presents a
framework for utilizing Reinforcement Learning (RL) to optimize the injection
process at accelerator facilities. By framing the optimization challenge as an
RL problem, we developed an agent capable of dynamically aligning the beam's
transverse space with desired targets. Our methodology leverages the Soft
Actor-Critic algorithm, enhanced with domain randomization and dense neural
networks, to train the agent in simulated environments with varying dynamics
promoting it to learn a generalized robust policy. The agent was evaluated in
live runs at the Cooler Synchrotron COSY and it has successfully optimized the
beam cross-section reaching human operator level but in notably less time. An
empirical study further validated the importance of each architecture component
in achieving a robust and generalized optimization strategy. The results
demonstrate the potential of RL in automating and improving optimization tasks
at particle acceleration facilities.
