Self-hosted service
PrefectHQ/prefect avatar
PrefectHQ/prefect

Prefect 3.8: Turning Python Scripts into Observable, Scheduled Workflows

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.

23,845 stars2,524 forksPythonApache-2.0

At a glance

What is it?
Prefect is an Apache-2.0 Python framework that wraps plain functions with flow and task decorators to add retries, scheduling, caching, and event-driven automation. This review covers how it works, how to run it, and where its self-hosted model falls short.
Who is it for?
Adopt Prefect if you are a Python team that wants to turn existing scripts into scheduled, observable workflows without learning a new DSL. Skip it if you need fine-grained control over distributed execution or if your pipelines are already running on a platform like Airflow and you have no reason to migrate.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What Prefect Solves for Data Engineers

Prefect addresses a common pain point: a Python script that works fine on your laptop fails in production because a dependency times out, a task crashes, or a schedule is missed. The README positions it as the way to elevate a script into a production workflow. It targets data teams who want to automate data processes with scheduling, caching, retries, and event-based automations. The core audience is Python developers who already write data pipelines and want orchestration without moving to a separate language or a heavy platform. The framework adds structure to plain functions, so you keep your code in Python and gain observability and resilience.

The Decorator Model: Flows and Tasks

Prefect's mechanism is simple on the surface. You decorate a function with @task and another with @flow. The flow calls the task, and Prefect tracks the execution. The README example fetches GitHub stars: get_stars is a task, github_stars is a flow that loops over a list and calls the task. This design means your code stays readable. The flow becomes the unit of orchestration, and tasks are the units of retry and logging. The @task(log_prints=True) argument shows that you can capture print output, which is useful for debugging. The flow can also be served as a deployment, which is where scheduling and parameters come in. This is a different approach from writing DAGs in a separate file; here the workflow is just Python control flow.

Running Prefect: Installation and First Steps

Installation is straightforward. The README gives two commands: pip install -U prefect and uv add prefect. Prefect requires Python 3.10 or newer. After installation, you create a Python file with the flow and task decorators. To see the workflow activity, you run prefect server start, which launches a self-hosted server and opens a UI at http://localhost:4200. The README says you can 'see what happened' after running the flow. To run on a schedule, you change the last line to github_stars.serve(name="first-deployment", cron="* * * * *", parameters={"repos": ["PrefectHQ/prefect"]}). This starts a local process that looks for scheduled deployments. You can also run deployments manually from the UI or CLI, and even trigger them from events. The commands are minimal, which lowers the barrier to entry.

Scheduling and Deployment: The serve Method

The serve method is the key to turning a flow into a scheduled job. In the example, you call github_stars.serve with a cron expression and parameters. This creates a deployment and runs a local process that watches for schedule triggers. The README notes that you can also run the workflow manually from the UI or CLI. This is a lightweight way to get scheduled execution without setting up a separate scheduler. However, the process runs locally, so it is not a distributed scheduler. For production, you would need to run this process on a server or container. The documentation points to deploying flows to production environments, but the README does not detail how to scale that out. The trade-off is simplicity versus control.

Where Prefect Falls Short: Self-Hosted Limits

The README mentions a self-hosted Prefect server instance and a managed Prefect Cloud dashboard. The open-source version gives you the server and UI, but the README does not specify which features are exclusive to Cloud. Event-based automations are mentioned, but it is unclear if they work fully on the self-hosted server. The prefect-client package is described as a lighter-weight option for communicating with Prefect Cloud or a remote server, which suggests that the full prefect package is heavier. For teams that need multi-tenant isolation, complex role-based access, or high availability, the self-hosted server may require significant setup. The README does not provide details on scaling the server, so you must check the docs. Also, the example uses httpx directly, which means network failures are not automatically handled unless you configure retries on the task. The framework does not magically make your code resilient.

Alternatives: Airflow and Dagster

Prefect's main alternative is Apache Airflow. Airflow uses a DAG file where each task is an operator, and the scheduler is a separate service. Airflow is more mature for complex dependency graphs and has a large ecosystem of operators. Prefect, by contrast, lets you write the workflow as normal Python control flow, which is more intuitive for simple pipelines. Dagster is another alternative; it focuses on software-defined assets and type safety across data pipelines. Dagster ties orchestration to data assets, which is useful for data engineering teams that want lineage. Prefect is simpler to adopt because it does not require a separate DAG definition or a new mental model. The choice depends on whether you need explicit DAGs or prefer the flexibility of decorators.

Maintenance, Upgrades, and License

Prefect is under the Apache-2.0 license, which is permissive for commercial use. The repository is active, with nightly development releases (3.8.5.dev1, 3.8.5.dev2) and a recent stable release 3.8.4. The README mentions a community of over 25,000 practitioners, but that number is not a quality metric. The release cadence suggests frequent updates, which means you should pin your version in production. Upgrading between minor versions may introduce changes to the API or server behavior. The prefect-client package is a lighter alternative for client-only use, which could reduce dependency footprint in ephemeral environments. There is no mention of a commercial license for the open-source version; Prefect Cloud is a separate paid product. You should verify that the features you rely on are in the open-source server and not gated behind Cloud.

Editorial conclusion

Adopt Prefect if you are a Python team that wants to turn existing scripts into scheduled, observable workflows without learning a new DSL. Skip it if you need fine-grained control over distributed execution or if your pipelines are already running on a platform like Airflow and you have no reason to migrate. Before committing, verify that your Python version is 3.10 or newer, test the self-hosted server on your infrastructure, and check whether the event-based automation features you need are available in the open-source version or only in Prefect Cloud.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Community notes

Community notes