https://github.com/flyteorg/flyte-sdk
Type-safe, distributed orchestration of agents, ML pipelines, and more — in pure Python with async/await.
https://github.com/flyteorg/flyte-sdk
ai async ml mlops
Last synced: 2 months ago
JSON representation
Type-safe, distributed orchestration of agents, ML pipelines, and more — in pure Python with async/await.
- Host: GitHub
- URL: https://github.com/flyteorg/flyte-sdk
- Owner: flyteorg
- License: apache-2.0
- Created: 2025-07-29T15:19:31.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-10-02T01:58:28.000Z (9 months ago)
- Last Synced: 2025-10-02T03:27:44.256Z (9 months ago)
- Topics: ai, async, ml, mlops
- Language: Python
- Homepage: https://flyte.org/
- Size: 2.82 MB
- Stars: 52
- Watchers: 0
- Forks: 17
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!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.
---
# Flyte 2 SDK
**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/union/api-reference/flyte-sdk/)
[](https://www.union.ai/docs/v2/union/api-reference/flyte-cli/)
## Install
```bash
pip install flyte
```
## 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}")
```
PythonFlyte 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)
```
PythonFlyte CLI
```bash
python serving.py
```
```bash
flyte serve serving.py env
```
### Local Development Experience
Install the TUI for a rich local development experience:
```bash
pip install flyte[tui]
```
[](https://www.youtube.com/watch?v=lsfy-7DbbRM)
## 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/union/api-reference/flyte-sdk/)** — API reference docs
- **[CLI Reference](https://www.union.ai/docs/v2/union/api-reference/flyte-cli/)** — CLI docs
- **[Join the Flyte 2 Production Preview](https://www.union.ai/try-flyte-2)** — Get early access
- **[Features](FEATURES.md)** — Async parallelism, app serving, tracing, and more
- **[Examples](examples/)** — Ready-to-run examples for every feature
- **[Contributing](CONTRIBUTING.md)** — Set up a dev environment and contribute
- **[Slack](https://slack.flyte.org/)** | **[GitHub Discussions](https://github.com/flyteorg/flyte/discussions)** | **[Issues](https://github.com/flyteorg/flyte/issues)**
## License
Apache 2.0 — see [LICENSE](LICENSE).