First run SQL Server Management Studio.
Then navigate to:
• Root
• SQL Server Instance
• SQL Server Agent
• Right click on SQL Server Agent

- From here right-click on history.
- Select the option to "Automatically remove agent history" and enter the duration that you want to keep the job history.
- Click on OK and you are ready to run.