The following examples demonstrate various utility scripts and automation tools built with the Prefect API. These examples are sourced from the PrefectHQ/examples repository.

ExampleDescription
create_automation.pyCreates a Prefect automation that sends email notifications when flow runs fail or crash. Demonstrates block and automation creation via the API.
cross_workspace_flow_runs.pyLists flow run counts by state and date across all workspaces in an account. Useful for analyzing flow run patterns and workspace usage.
extract_with_dlt.pyShows how to extract Prefect Cloud data (deployments, flows, flow runs) using the dlt (data load tool) library into a DuckDB database.
list_block_versions.pyDisplays a table of all block types in a workspace with their versions, creation dates, and checksums. Helpful for auditing block versions.
update_deployment_concurrency_limit.pyUpdates a deployment’s concurrency limits via the API. Useful when working with Prefect 2.x installations where direct model updates aren’t supported.