CronJob is that second thing.
Overview
The smallest job
run() blocks. Press Ctrl-C to stop, or call job.stop() from another thread.
Interval format
"<number><unit>", where unit is seconds, minutes or hours.
Several tasks, one cadence
When one agent has several checks that share a schedule,batched_run registers all of them and runs each on every tick.
Passing arguments through
Anything you pass as a keyword reaches the agent’srun on every tick.
Stopping on a timer
run() blocks, so schedule the stop from another thread.
Checking on it
get_execution_stats() is safe to call from another thread while the job runs.
execution_count is successes. error_count is total failures. The one to watch is consecutive_errors: occasional failures on a long-running job are normal, a rising streak is not.
What happens when the agent fails
Nothing dramatic, by design. The failure is logged with a traceback and the task runs again on the next tick, the way cron behaves. A rate limit or a dropped connection does not end your job. If you want a job to give up when it is failing every time, give it a budget:run() raises CronJobExecutionError, so a dead schedule is never mistaken for a healthy one. The default is None, which retries forever.
See Failure Handling and Monitoring for the full pattern.
Next steps
Multiple Agents
Several agents, each on its own cadence, in one process
Failure Handling
Error budgets, live monitoring, and non-blocking fleets
CronJob Reference
Full parameter and method documentation
Runnable Examples
The example files in the repository