> [!IMPORTANT]
> ## Flyte 2 Devbox is now available!
>
> Check out the guide [here](https://www.union.ai/docs/v2/flyte/user-guide/run-modes/running-devbox/) to get started.
>
> Looking for Flyte 1? Go to the [master](https://github.com/flyteorg/flyte/tree/master) branch, where Flyte 1 is now maintained.
---
# Flyte 2
**Reliably orchestrate ML pipelines, models, and agents at scale — in pure Python.**
[](https://pypi.org/project/flyte/)
[](https://pypi.org/project/flyte/)
[](LICENSE)
[](https://flyte2intro.apps.demo.hosted.unionai.cloud/)
[](https://www.union.ai/docs/v2/flyte/user-guide/running-locally/)
[](https://www.union.ai/docs/v2/byoc/api-reference/flyte-sdk/)
[](https://www.union.ai/docs/v2/byoc/api-reference/flyte-cli/)
Flyte is a Graduated project of the [LF AI & Data Foundation](https://lfaidata.foundation/projects/flyte/).
## Install
```bash
uv pip install flyte
```
For the full SDK and development tools, see the [flyte-sdk](https://github.com/flyteorg/flyte-sdk) repository.
## Example
```python
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}")
```
| Python | Flyte CLI |
|
```bash
python hello.py
```
|
```bash
flyte run hello.py main --numbers '[1,2,3]'
```
|
## Serve a Model
```python
# serving.py
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)
```
| Python | Flyte CLI |
|
```bash
python serving.py
```
|
```bash
flyte serve serving.py env
```
|
## Local Development Experience
Install the TUI for a rich local development experience:
```bash
uv pip install flyte[tui]
```
[](https://www.youtube.com/watch?v=lsfy-7DbbRM)
**[Try the hosted demo in your browser](https://flyte2intro.apps.demo.hosted.unionai.cloud/)** — no installation required.
## Open Source Backend
The open source backend for Flyte 2 is **coming soon**. This repository will contain the Kubernetes-native backend infrastructure for deploying Flyte 2 as a distributed, multi-node service. See the [Backend README](docs/BACKEND_README.md) for the current state of the backend, protocol buffer definitions, and contribution guide.
If you need an enterprise-ready, production-grade backend for Flyte 2 today, it is available on [Union.ai](https://www.union.ai/try-flyte-2).
## Learn More
- **[Live Demo](https://flyte2intro.apps.demo.hosted.unionai.cloud/)** — Try Flyte 2 in your browser
- **[Documentation](https://www.union.ai/docs/v2/flyte/user-guide/running-locally/)** — Get started running locally
- **[SDK Reference](https://www.union.ai/docs/v2/byoc/api-reference/flyte-sdk/)** — API reference docs
- **[CLI Reference](https://www.union.ai/docs/v2/byoc/api-reference/flyte-cli/)** — CLI docs
- **[flyte-sdk](https://github.com/flyteorg/flyte-sdk)** — The Flyte 2 Python SDK repository
- **[Join the Flyte 2 Production Preview](https://www.union.ai/try-flyte-2)** — Get early access
- **[Slack](https://slack.flyte.org/)** | **[GitHub Discussions](https://github.com/flyteorg/flyte/discussions)** | **[Issues](https://github.com/flyteorg/flyte/issues)**
## Contributing
We welcome contributions! See the [Backend README](docs/BACKEND_README.md) for backend development, or join us on [slack.flyte.org](https://slack.flyte.org).
## Sponsors
CI container image builds for this repository are sponsored by [Depot](https://depot.dev) — fast, native multi-arch Docker builds with persistent layer caching.
[](https://depot.dev)
## License
Apache 2.0 — see [LICENSE](LICENSE).