The following examples demonstrate various features and patterns of Prefect flows. These examples are sourced from the PrefectHQ/examples repository.

ExampleDescription
hello_world.pyA simple “Hello World” flow demonstrating basic flow creation and execution.
access_run_context.pyShows how to access and use flow run context information within flows and tasks.
force_out_of_memory.pyDemonstrates how to reproduce and diagnose memory issues in flows.
local_concurrency_with_async.pyImplements concurrent API requests using Python’s native async capabilities.
local_concurrency_with_task_runner.pyShows how to achieve concurrency using Prefect’s ThreadPoolTaskRunner.
return_custom_state.pyDemonstrates returning custom states from tasks, specifically for implementing retry logic.
schedule_specific_parameters.pyShows how to bind specific parameters to a schedule.
update_flow_run_state_from_hook.pyShows how to update flow run states using hooks and the Prefect client.
update_flow_run_tags.pyDemonstrates updating flow run tags during execution.
whoami.pyA diagnostic flow that logs information about the current execution environment.