flyteorg/flyte

Dynamic, resilient AI orchestration. Coordinate data, models, and compute as you build AI workflows.

Flyte 2 – Open‑source AI/ML orchestration runtime

What it is – Flyte 2 is a pure‑Python framework for reliably orchestrating machine‑learning pipelines, models and AI agents at scale. It provides a lightweight SDK and a command‑line interface that let you define tasks, compose them into workflows, and run them locally or on a distributed backend (Kubernetes‑native, coming soon). The project is a graduated LF AI & Data Foundation project and is the successor to Flyte 1.

Key capabilities

  • Task‑centric API – Write ordinary Python functions (sync or async) and decorate them with @env.task. Flyte handles containerisation, dependency specification, and remote execution.
  • Simple execution – Run a workflow with flyte.run(...) in code or with flyte run <file> <task> … from the CLI.
  • Model serving – Wrap a FastAPI app in a FastAPIAppEnvironment and serve it with flyte serve.
  • Local developer experience – Optional TUI (flyte[tui]) gives a rich terminal UI for inspecting tasks, logs and execution status.
  • Extensible runtime – The open‑source backend (Kubernetes‑native) is being built in this repo; an enterprise‑ready backend is available from Union.ai today.
  • Pure‑Python installation – Install with uv pip install flyte (or via pip directly). The full SDK lives in the companion flyte-sdk repository.

Typical workflow

import asyncio, 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(n) for n 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 locally with python hello.py or via the CLI:

flyte run hello.py main --numbers '[1,2,3]'

Serving a model

from fastapi import FastAPI
import flyte
from flyte.app.extras import FastAPIAppEnvironment

app = FastAPI()
env = FastAPIAppEnvironment(
    name="my-model",
    app=app,
    image=flyte.Image.from_debian_base(python_version=(3,12)).with_pip_packages(
        "fastapi", "uvicorn"
    ),
)

@app.get("/predict")
async def predict(x: float) -> dict:
    return {"result": x * 2 + 5}

if __name__ == "__main__":
    flyte.init_from_config()
    flyte.serve(env)

Run with python serving.py or flyte serve serving.py env.

Getting started – The repo ships a DevBox for quick local trials and a ready‑to‑use GitHub Codespaces template. A 10‑minute Colab notebook (ten_minutes_to_flyte.ipynb) walks new users through the basics.

Where it fits – Flyte 2 is useful for:

  • Data‑science teams that need reproducible, versioned pipelines without learning a new DSL.
  • ML engineers deploying models as services (FastAPI, etc.) with automatic container handling.
  • Researchers building multi‑step experiments that may run locally or later scale to a Kubernetes cluster.

Links

License – Apache 2.0.

Related

  • Project
  • Project
  • Project
  • Project
  • Project