Overview
Flyte is a workflow engine for orchestrating machine learning pipelines, models, and agents in pure Python. You define tasks as plain Python functions, and Flyte runs them as a versioned, reproducible workflow that can scale from your laptop to a distributed cluster.
It is built for ML and data engineers who want to move from local scripts to production without rewriting their code. Flyte 2 lets you write ordinary async Python, run it locally with a single command, and execute the same code on a Kubernetes-native backend.
Within the compute orchestration space, Flyte focuses on reproducibility and versioning. Each task runs in a defined container image, and the same workflow can be invoked from Python or the Flyte CLI.
What it does
- Define workflow tasks as plain Python functions using the @env.task decorator
- Write async pipelines and fan out work with calls like calculate.aio(num) plus asyncio.gather
- Pin each task to a container image with flyte.Image.from_debian_base and with_pip_packages
- Run the same code locally with python or remotely with the flyte run CLI
- Serve models as endpoints, including FastAPI apps via FastAPIAppEnvironment
- Local TUI for a richer development experience via the flyte[tui] extra
Getting started
Install Flyte, write a task in Python, and run it locally or through the CLI.
Install Flyte
Install the core package with uv. For the TUI local development experience, install the tui extra instead.
uv pip install flyteWrite a workflow
Define a task environment and decorate Python functions as tasks. The async main task fans out work across the calculate task.
import asyncio
import flyte
env = flyte.TaskEnvironment(
name="hello_world",
image=flyte.Image.from_debian_base(python_version=(3, 12)),
)
@env.task
def calculate(x: int) -> int:
return x * 2 + 5
@env.task
async def main(numbers: list[int]) -> float:
results = await asyncio.gather(*[
calculate.aio(num) for num in numbers
])
return sum(results) / len(results)
if __name__ == "__main__":
flyte.init()
run = flyte.run(main, numbers=list(range(10)))
print(f"Result: {run.result}")Run it
Run the script directly with Python, or invoke the workflow through the Flyte CLI with inline arguments.
flyte run hello.py main --numbers '[1,2,3]'Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Turn local ML training scripts into versioned, reproducible pipelines that run on a cluster
- Fan out parallel data or model tasks using async Python and asyncio.gather
- Serve a trained model as an HTTP endpoint with a FastAPI app
- Run the same workflow locally during development and remotely in production without code changes
How Flyte compares
Flyte alongside other open-source gpu & compute clouds tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Daytona | ★ 72.2k | Daytona is an open-source runtime that spins up isolated sandboxes in under 90ms so agents can safely run and persist AI-generated code. |
| Ray | ★ 43.2k | A distributed computing framework that scales Python and ML workloads for training, tuning, data processing, and serving. |
| Prefect | ★ 23.3k | A Python-native workflow orchestration tool for scheduling, running, and monitoring data and ML pipelines. |
| Dagster | ★ 15.8k | A data and ML pipeline orchestrator with a declarative asset model, built-in lineage, and observability. |
| Kubeflow | ★ 15.8k | A Kubernetes toolkit that brings together pipelines, notebooks, and training operators for running ML workflows at scale. |
| E2B | ★ 13k | E2B is open-source infrastructure that runs AI-generated code inside secure, isolated cloud sandboxes, controlled from JavaScript or Python SDKs. |
| OpenSandbox | ★ 12k | OpenSandbox gives AI agents a safe place to run code and commands, with one unified API across Docker and Kubernetes runtimes and SDKs in five languages. |
| Flyte | ★ 7.1k | Orchestrate ML pipelines, models, and agents at scale in pure Python |