If you are running a function that occasionally fails, such as calling an API, it is helpful to rerun the function on failure.
Prefect allows you to retry a task (a function with the task decorator) up to a specified number of times.
If you are not aware of Prefect, check out the getting started tutorials.