def AutomationClient.create_cron_automation(
name: str,
task: CronTask,
cron_schedules: str | list[str],
cluster: ClusterSlugLike | None = None,
max_retries: int = 0,
) -> AutomationPrototype
Create an automation that submits a task on one or more cron schedules.
Parameters
Name of the automation to create.
Task to run when the automation is triggered.
Cron schedule or schedules that trigger the automation.
Cluster to run the task on. If not provided, the default cluster is used.
Maximum number of retries for the task. Defaults to 0.
Returns
The created automation prototype.
automation = client.automations().create_cron_automation(
name="daily-index-refresh",
task=RefreshIndex(),
cron_schedules="0 2 * * *",
cluster="default",
)