flyte-sdk
Type-safe, distributed orchestration of agents, ML pipelines, and real-time inference — in pure Python with async/await.
Flyte 2 SDK: type safe distributed orchestration in Python
The Flyte 2 SDK orchestrates ML pipelines, models, and agents at scale using plain Python with async and await.
What the Flyte 2 SDK orchestrates
The Flyte 2 SDK is presented in its README as a way to reliably orchestrate ML pipelines, models, and agents at scale using pure Python. The project is the second major version of Flyte, and the README announces that Flyte 2 is generally available and points to a blog post about the durable open source AI runtime. The SDK lets a developer write ordinary Python functions and treat them as tasks in a distributed run, rather than learning a separate workflow language. The README says the orchestration covers machine learning pipelines, model serving style work, and agents, which reflects how Flyte has expanded from data and ML pipelines toward AI agent workflows. The framing is about reliability at scale, meaning the system is meant for work that must run correctly across many steps and possibly many machines. The README links to a Devbox for trying Flyte 2 locally, which is the suggested path for a first hands on run. By staying in Python with async and await, the SDK fits how modern Python developers already write concurrent code, so the learning curve is the Flyte concepts rather than a new syntax. The README's badges for version, Python support, license, docs, SDK reference, and CLI reference show a documented, packaged project rather than a bare repository.
Installing and defining a first workflow
The README gives a simple install line: pip install flyte. After that, the example creates a file called flyte_intro.py. Inside, it imports asyncio and flyte, then builds a TaskEnvironment with a name and an image derived from a Debian base at Python 3.12. Tasks are defined by decorating async functions with the environment's task decorator. The example shows a predict task that takes an int and returns an int, with retries set to 3 and cache set to auto, and a main task that gathers several predict calls and returns their average. The decorator is where Flyte specifics appear: retries control how many times a task runs again after failure, and the auto cache avoids recomputing the same inputs. The README shows two ways to run this. In Python, the user runs the file directly with the python command. With the Flyte CLI, the user runs flyte run flyte_intro.py main and passes data as a JSON list such as bracket one comma two comma three bracket. This dual path means the same code works as a normal Python program and as a managed Flyte run, which is the practical appeal of writing tasks as plain functions. The README keeps the example small so the concepts of environment, task, retries, and cache are clear.
Caching, retries, and running modes
Two reliability features appear directly in the README example and deserve attention. The cache equals auto setting on a task tells Flyte to reuse a previous result when the inputs match, which saves time and compute on repeated runs of the same logic. The retries equals 3 setting tells Flyte to attempt the task up to three times before marking it failed, which absorbs transient errors. These are declared inline on the task decorator, so the behavior is part of the code rather than external configuration. The README also distinguishes running modes, pointing to documentation about running locally and about the Devbox run mode for Flyte 2. The Devbox is the recommended way to try the new version locally, which suggests Flyte 2 has a container based local environment rather than a simple pip run. The CLI reference and SDK reference badges in the README indicate that the command line and the Python API are both documented in detail outside the readme. For a team adopting the SDK, the practical story is that business logic lives in async Python functions, Flyte handles distribution and recovery through retries and caching, and both a Python run and a CLI run are available depending on whether the user wants a local script or a managed execution.
Licensing, docs, and maturity signals
The README presents several signals about the project's maturity and openness. It is published under the Apache 2.0 license, shown in a badge and stated in the install section context, which is a permissive license with a patent grant suitable for commercial and open source use. The version badge points to PyPI, so the SDK is distributed as the flyte package through the standard Python index. The Python versions badge tells a reader which interpreters are supported. The docs badge links to the Flyte 2 user guide for running locally, and the SDK and CLI reference badges link to API documentation, which means a developer can read both conceptual guides and exact function signatures. The announcement that Flyte 2 is generally available is a maturity marker: the project has moved past experimental status for this version. The README's top callout about general availability and the Devbox link are the entry points for new users. For someone evaluating the SDK, the key facts from the README are that it is Python with async and await, installed via pip, licensed under Apache 2.0, documented with both guides and API references, and focused on orchestrating pipelines, models, and agents reliably at scale through task environments, caching, and retries.
Editorial conclusion
The Flyte 2 SDK is written in Python and published under the Apache 2.0 license. The README installs it with pip install flyte and shows tasks defined through a TaskEnvironment decorator.
Community notes