# Alternative to Prefect for building workflows

> How does Windmill compare to Prefect for building workflows, execution runtime, and observability?

![Windmill Prefect](../assets/compared_to/windmill_prefect.png 'Windmill Prefect')

Both Windmill and Prefect support writing complex workflows and ETL with code and run them at scale.
We highlight below the main differences between the 2 on the following axis:

- [Open source and hosting](#open-source-and-hosting)
- [Workflows and code](#workflows-and-code)
- [Triggers](#triggers)
- [Execution runtime and coldstarts](#execution-runtime-and-coldstarts)
  - [Example benchmark](#example-benchmark)
- [Observability and monitoring](#observability-and-monitoring)
- [Windmill AI](#windmill-ai)
- [Pricing](#pricing)
- [Scripts and apps](#scripts-and-apps)

<a href="https://www.prefect.io/" rel="nofollow"> Prefect </a> is a data workflow management system, designed to help teams build, run, and monitor data workflows. It provides tools for orchestrating data pipelines, managing their execution, and ensuring data integrity.

## Open source and hosting

[Windmill](https://www.windmill.dev/) is fully open source. This implies that Windmill can be self-hosted with just a few commands, providing cost-effective and secure solutions.

Windmill offers a clean slate, allowing you to fully explore its platform before committing to the product.
Windmill's open-source nature ensures that the platform is tested, approved, and continuously enhanced
to meet the community's needs.

Windmill provides and integrates into its platform a [public community Hub](https://hub.windmill.dev/) where users share useful and proven scripts, flows, and applications.

![Windmill GitHub](../assets/compared_to/windmill_gh.png 'Windmill GitHub')

Prefect has an Apache v2.0 License and can be self-hosted.

Prefect's [monitoring](#observability-and-monitoring) is done through a cloud platform that requires subscription. Many of the features necessary for its proper functioning are only available under Prefect Cloud:

![Prefect cloud features](../assets/compared_to/prefect_cloud_features.png 'Prefect cloud features')

## Workflows and code

Prefect and Windmill Flow editor have a very similar sets of features. Below are the advanced features presented by Prefect and, in backlink, their counterpart on Windmill:

- [scheduling](../core_concepts/1_scheduling/index.mdx)
- [retries](../flows/14_retries.md)
- [logging](../core_concepts/14_audit_logs/index.mdx)
- [convenient async functionality](../core_concepts/4_webhooks/index.mdx#asynchronous)
- [caching](../flows/4_cache.mdx)
- [notifications](../core_concepts/1_scheduling/index.mdx#be-notified-every-time-a-scheduled-workflow-has-been-executed)
- [observability](../core_concepts/5_monitor_past_and_future_runs/index.mdx)
- [event-based orchestration](../triggers/index.mdx)

We could also mention [storage of configuration](../core_concepts/3_resources_and_types/index.mdx) or [error handling](../core_concepts/10_error_handling/index.mdx) that are dealt with in a similar manner.

![Prefect features](../assets/compared_to/prefect_features.png.webp 'Prefect features')

Prefect is heavily code-based. Everything is and can only be defined in Python. The steps and their configurations are defined by code:

![Prefect flow](../assets/compared_to/flow_prefect.png.webp 'Prefect flow')

> [Flow](#example-benchmark) "_Given a GitHub repository, logs the number of stargazers and contributors for that repo_" on Prefect.

Windmill offers both low-code and code-based solutions.

![Windmill compared to Prefect](../assets/compared_to/windmill_compared_prefect.png 'Windmill compared to Prefect')

### Flow editor

In Windmill's [Flow editor](../flows/1_flow_editor.mdx), the steps are also code-based but built from scripts ([TypeScript](../getting_started/0_scripts_quickstart/1_typescript_quickstart/index.mdx), [Python](../getting_started/0_scripts_quickstart/2_python_quickstart/index.mdx), [Go](../getting_started/0_scripts_quickstart/3_go_quickstart/index.mdx), [Bash](../getting_started/0_scripts_quickstart/4_bash_quickstart/index.mdx), [SQL](../getting_started/0_scripts_quickstart/5_sql_quickstart/index.mdx) ...). Users can write the code directly, choose a script from the workspace, the community library [WindmillHub](https://hub.windmill.dev/), or have it [generated with AI](#windmill-ai). Each script can be saved with [permissions](../core_concepts/16_roles_and_permissions/index.mdx) set from the workspace.

The structuring of the flow and the configurations for each step are defined from a User Interface. With a _code when you need_ mindset, the user can navigate the flow editor in low-code.

![Windmill flow](../assets/compared_to/flow_windmill.png.webp 'Windmill flow')

> [Flow](#example-benchmark) "_Given a GitHub repository, logs the number of stargazers and contributors for that repo_" on Windmill.

In particular, Windmill [generates automatically UIs](../core_concepts/6_auto_generated_uis/index.mdx) for flows and steps and lets users [test](../core_concepts/23_instant_preview/index.mdx) flows, steps or flow until a given step, from the UI.

Flows can be [defined visually / YAML](../advanced/4_local_development/index.mdx) on a local environment. In particular, Windmill has a [VS Code extension](../cli_local_dev/1_vscode-extension/index.mdx) to edit from your code editor scripts flows YAML.

### Workflows as code

[Flows](#flow-editor) are not the only way to write distributed programs that execute distinct jobs. Another approach is to write a program that defines the jobs and their dependencies, and then execute that program. This is known as [workflows as code](../core_concepts/31_workflows_as_code/index.mdx).

![Script in python executing workflow as code](../core_concepts/31_workflows_as_code/wac-editor-1.png "Script in python executing workflow as code")

Windmill supports defining workflows as code in a single script in both [Python](../getting_started/0_scripts_quickstart/2_python_quickstart/index.mdx) and [TypeScript](../getting_started/0_scripts_quickstart/1_typescript_quickstart/index.mdx) using intuitive and lightweight syntax.

Here is an example of a workflow as code with Prefect (from their <a href="https://docs.prefect.io/latest/concepts/tasks/" rel="nofollow">documentation</a>):

```python
from prefect import flow, task

@task
def my_first_task(msg):
    print(f"Hello, {msg}")

@task
def my_second_task(msg):
    my_first_task.fn(msg)

@flow
def my_flow():
    my_second_task("Trillian")
```

and the same example with [Windmill](../core_concepts/31_workflows_as_code/index.mdx) (in Python):

```python
from wmill import task

@task
def my_first_task(msg):
    print(f"Hello, {msg}")

@task
def my_second_task(msg):
    my_first_task(msg)

def main():
   my_second_task("Trillian")
```

## Triggers

Prefect uses a deployment system from the terminal to trigger and schedule its flows.

To manage its triggers from the Prefect UI, you have to go through a separate menu called <a href="https://docs.prefect.io/latest/concepts/automations/" rel="nofollow">Automations</a> (available on the Prefect cloud only) and go through many actions before actually triggering the flow.

While Windmill also allows configuration and triggers from the terminal, the platform is designed to schedule, manually trigger, generate webhooks or UIs from the Windmill UI (cloud or self-hosted).

> Example of a flow scheduled manually via the UI on Windmill.

## Execution runtime and coldstarts

Windmill's architecture allows running each task on the current fleet of worker
(which you can auto-scale automatically) and hence do not suffer from cold start.
Isolation and creating dedicated dependency environment is the secret sauce that makes Windmill
the fastest execution runtime for scripts (10ms cold start).

Windmill can run 26M tasks a month on a single worker costing 5$. Prefect does not provide figures on its average runtime and performance.

Also, Windmill has a [transparent API](https://app.windmill.dev/openapi.html#/), on which you could imagine launching 1m simulateously by API.

We have conducted [benchmarks](../misc/3_benchmarks/index.mdx) to measure our performance against our competitors.

For comparison, you will find below a test between Prefect and Windmill for cold start, execution, and result of an [example flow shared by Prefect](#example-benchmark).

Each instance is self-hosted.

### Example benchmark

Flow "Given a GitHub repository, logs the number of stargazers and contributors for that repo", <a href="https://docs.prefect.io/latest/getting-started/quickstart/#step-3-write-a-flow" rel="nofollow">shared by Prefect</a> on their quickstart (measured in September 2023):

![Prefect flow example](../assets/compared_to/prefect_flow_example.png.webp 'Prefect flow example')

- Prefect: Cold start + Execution + Results = 8.09s
- Windmill: Cold start + Execution + Results = 1.13s

For up-to-date numbers across engines, refer to the regularly refreshed [benchmarks](../misc/3_benchmarks/competitors/index.mdx).

Trust but verify: to ensure the performance of Windmill's workers and measure their capabilities,
we provide a benchmarking tool. This tool allows you to benchmark the execution of jobs and flows,
providing insights into the performance metrics.

## Observability and monitoring

In terms of monitoring and observability, Windmill and Prefect's cloud app fulfill the same functions: audit logs, monitoring of runs and schedules, saving of flows, configurations (<a href="https://docs.prefect.io/latest/concepts/blocks/?h=blocks" rel="nofollow">Blocks</a> in Prefect, [Resource types](../core_concepts/3_resources_and_types/index.mdx) in Windmill) and variables, [allocation of workers](../core_concepts/9_worker_groups/index.mdx).

The main difference is that Prefect's application seems to be conceived as a reliable source for reporting actions from Prefect, whereas with Windmill, the application provides more control as everything can be done from the Windmill app (creation of scripts, flows apps, triggers, monitoring, [permissions](../core_concepts/16_roles_and_permissions/index.mdx), etc.)

## Windmill AI

Windmill provides ways to have AI help you in your coding experience. From prompts, generate scripts that interact with your integrations, or flows where the AI manages the data transmission between steps, or even automatic error resolution.

## Pricing

Windmill has a [transparent pricing policy](/pricing), with clear steps for implementation.

Windmill is cheaper at scale and can be used for free at any scale thanks to its open source nature.

As of November 18, 2024, Prefect does not disclose its Enterprise pricing (see below).

Prefect pricing:

![Prefect pricing](../assets/compared_to/prefect_pricing.png 'Prefect pricing')

## Scripts and apps

This document has focused on the Flow editor since it is the product closest to what Prefect does. However, Windmill also includes Script and App editors.

The [script editor](../script_editor/index.mdx) allows users to build long-running heavy background jobs, script with complex dependencies, endpoints with high rpm or simple one-off tasks without any overhead. They can be triggered them from a webhook, auto-generated UIs, flows, apps etc.

![Script languages](../../static/images/script_languages.png 'Script languages')

The [low-code app editor](../apps/0_app_editor/index.mdx) goes beyond auto-generated UIs and allows you to create your own customized UIs using drag-and-drop from components powered by Windmill scripts and flows. For full control, [full-code apps](../full_code_apps/index.mdx) let you build custom frontends with React or Svelte connected to Windmill backend runnables.

![App editor](../assets/apps/0_app_editor/app-editor.png.webp 'App editor')

In conclusion, Prefect is an excellent tool for building workflows and heavy data ETL. From Windmill's perspective, Prefect's flows don't lack major features.

However, Windmill distinguishes itself from Prefect by providing more control for building and monitoring flows, as well as scripts and UIs, all from a single open-source platform.
