Create Scheduled Workflows

Use dbos.WithSchedule when registering a workflow to run it on a cron schedule. Each scheduled invocation runs exactly once per interval. Scheduled workflows mu

CRO
bykursku215 words

What is Create Scheduled Workflows?

What this skill does

Create Scheduled Workflows enables marketers to automate tasks by running workflows on a precise cron schedule using dbos.WithSchedule. Each scheduled invocation triggers exactly once per defined interval, ensuring consistent execution without gaps. This method replaces manual, error-prone scheduling approaches and guarantees durability even during downtime.

Scheduled workflows must accept a single `time.Time` parameter representing when the task runs, allowing for accurate timestamping and time-based decisions within the workflow. The cron syntax supports six fields with second-level precision, enabling fine-grained control over timing.

Who it's for

This skill is designed for growth leads automating regular reporting and campaign updates, performance marketers managing timed optimizations, and agency strategists coordinating recurring audit and content refresh workflows. Anyone needing reliable, repeatable execution of tasks like daily data pulls, weekly A/B test resets, or hourly audience segment updates will benefit.

It suits scenarios where manual triggers are unreliable or where timing precision impacts campaign performance, such as launching promotions at exact hours or syncing with external data refresh cycles.

Key workflows

First, define your workflow function to accept a single `time.Time` parameter indicating the scheduled run time. Next, register this workflow using `dbos.RegisterWorkflow` with the `dbos.WithSchedule` option, specifying your cron expression for the desired interval. Third, implement any core logic inside the workflow, often wrapped as steps using `dbos.RunAsStep` to capture status and errors clearly. Finally, launch the scheduler context with `dbos.Launch` to activate the recurring execution and monitor logs or outputs to verify timely runs.

Throughout, focus on testing the cron syntax to align with campaign timing needs and ensure your workflows handle missed or delayed executions gracefully.

Common questions

Can scheduled workflows run multiple times if delayed? No; each scheduled invocation runs once per interval, preventing duplicates. What parameter signature is required for scheduled workflows? Exactly one `time.Time` parameter indicating the scheduled execution time. How precise is the cron schedule? The scheduler supports six fields with second-level precision, allowing sub-minute intervals.

How to use in Metaflow

Attach the Create Scheduled Workflows skill to a Metaflow agent task by configuring the workflow registration to include the desired cron schedule through `dbos.WithSchedule`. Expect your workflow to trigger reliably at the specified intervals with the scheduled timestamp passed as input. This setup replaces manual timing logic and ensures durable, consistent execution across downtime and restarts. For detailed implementation steps, refer to the scheduling tutorial and examples within the skill documentation.

For broader context, see our roundup of claude skills for marketing, and read Claude Code workflows for marketing agencies for related setup guidance.