Build bulletproof workflows
Ship resilient code faster, and turn your workflows into powerful applications
1from prefect import flow, task
2
3
4@task(log_prints=True)
5def say_hello(name: str):
6 print(f"Hello {name}!")
7
8
9@flow
10def hello_universe(names: list[str]):
11 for name in names:
12 say_hello(name)
13
14
15if __name__ == "__main__":
16 # create your first deployment to automate your flow
17 hello_universe.serve(name="your-first-deployment")
Ship trustworthy pipelines faster
With Prefect orchestration, build scalable workflows in pure python without changing how you work:
- Scheduling
- Retries
- Parameterization
- Dependency management
- Caching
1import httpx
2from prefect import flow, task
3
4
5@task
6def get_url(url: str, params: dict = None):
7 response = httpx.get(url, params=params)
8 response.raise_for_status()
9 return response.json()
10
11
12@flow(retries=3, retry_delay_seconds=5, log_prints=True)
13def get_repo_info(repo_name: str = "PrefectHQ/prefect"):
14 url = f"https://api.github.com/repos/{repo_name}"
15 repo_stats = get_url(url)
16 print(f"{repo_name} repository statistics 🤓:")
17 print(f"Stars 🌠 : {repo_stats['stargazers_count']}")
18 print(f"Forks 🍴 : {repo_stats['forks_count']}")
19
20
21if __name__ == "__main__":
22 get_repo_info.serve(name="my-first-deployment")
![David Anderson](https://cdn.statically.io/img/www.prefect.io/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F3ugk85nk%2Fproduction%2Fe79bb0f4ccf6d82bb3496b720954dd54a4b5e708-787x787.jpg%3Fw%3D220%26fit%3Dmax%26auto%3Dformat&w=3840&q=75)
![Matt Delacour](https://cdn.statically.io/img/www.prefect.io/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F3ugk85nk%2Fproduction%2Fc9101a53a46f31516c43d793aebf22f65829af90-200x200.jpg%3Fw%3D220%26fit%3Dmax%26auto%3Dformat&w=3840&q=75)
![Chandler Soto](https://cdn.statically.io/img/www.prefect.io/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F3ugk85nk%2Fproduction%2Fe0a6548cdc6c578ae7817ab6f683f5fdc9917d2c-800x800.jpg%3Fw%3D220%26fit%3Dmax%26auto%3Dformat&w=3840&q=75)
Visualize, monitor, and triage
From the individual flow to your entire system health, always know where your failures are:
- Visualize the execution graph of thousands of workflow tasks
- Inspect individual workflows, or track holistic health
- Notify your stakeholders and get ahead of questions
![alt](https://cdn.statically.io/img/www.prefect.io/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F3ugk85nk%2Fproduction%2F81a9ae60c2e1b9753263b36800b409df6284d2d0-3840x2290.png%3Fq%3D90%26fit%3Dmax%26auto%3Dformat&w=3840&q=75)
![](https://cdn.statically.io/img/www.prefect.io/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F3ugk85nk%2Fproduction%2F470ed3391adde5b6d0d8f70a9af239910a4955b7-1595x1016.png%3Ffit%3Dmax%26auto%3Dformat&w=3840&q=75)
Dev to production, simplified
Spin up a local orchestration server with a single command. No code changes means your workflow runs as expected, locally or in production.
$ prefect server start
___ ___ ___ ___ ___ ___ _____
| _ \ _ \ __| __| __/ __|_ _|
| _/ / _|| _|| _| (__ | |
|_| |_|_\___|_| |___\___| |_|
Configure Prefect to communicate with the server with:
prefect config set PREFECT_API_URL=http://127.0.0.1:4200/api
View the API reference documentation at http://127.0.0.1:4200/docs
Check out the dashboard at http://127.0.0.1:4200
![](https://cdn.statically.io/img/www.prefect.io/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F3ugk85nk%2Fproduction%2F1b9208b58437a475edb6a67f9260e5a07cd2a47c-960x540.jpg%3Fw%3D300%26fit%3Dmax%26auto%3Dformat&w=3840&q=75)
Learn About Prefect
Just write python
Add a single decorator to your functions to gain scheduling, monitoring, and resiliency without unnecessary abstractions.
1import prefect
2from prefect import flow
3
4@flow
5def simple_looping_flow():
6 for i in range(5):
7 print(f"Current iteration: {i}")
8
9if __name__ == "__main__":
10 simple_looping_flow.serve(name="simple_looping_flow_deployment")
Infrastructure agnostic
Configure your execution environment, all the way down to the individual @flow. With work pools and work queues, you have granular control over your infrastructure.
Granular access controls
Stay compliant and manage provisions & permissions the way you want to
- SSO & SCIM
- Team management
- Custom roles and RBAC
- Object-level access control
![](https://cdn.statically.io/img/www.prefect.io/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F3ugk85nk%2Fproduction%2Fa1d3fe366952cdda620d1d62e6903b7d33304225-745x808.png%3Ffit%3Dmax%26auto%3Dformat&w=3840&q=75)