Overview
Metaflow is an open-source Python framework, originally built at Netflix and now supported by Outerbounds, for building and managing real-world AI and ML systems. It gives data scientists and engineers a single API that covers the full lifecycle, from quick local prototyping in notebooks to maintainable production deployments.
It is aimed at research and engineering teams who want to move fast without rewriting their code as a project grows. You write your workflow once as a normal Python class, and the same code runs on your laptop or scales out to cloud compute on CPUs and GPUs.
As a compute-orchestration tool in the MLOps space, Metaflow unifies code, data, and compute. It handles experiment tracking, versioning, and visualization automatically, and lets you deploy the same flow to production-grade workflow orchestrators.
What it does
- Pythonic API for defining workflows as classes with @step-decorated methods, runnable locally with no extra setup
- Built-in experiment tracking, versioning, and result visualization, plus support for notebook-based runs
- Scales horizontally and vertically to cloud compute on CPUs and GPUs, including parallel foreach and gang-scheduled distributed jobs
- Fast data access and reliable handling of failures and checkpointing for data-intensive workloads
- Dependency management and one-click deployment to production orchestrators with event-based reactive orchestration
- Same code runs from laptop to cloud, so prototypes move to production without a rewrite
Getting started
Install Metaflow from PyPI or conda-forge, then write and run a small flow locally to confirm everything works.
Install Metaflow
Install into your Python environment from PyPI, or use conda-forge if you prefer conda.
pip install metaflowWrite a minimal flow
A flow is a Python class that subclasses FlowSpec. Every flow needs a start step and an end step, and each step calls self.next() to point to the next one. Save this as helloworld.py.
from metaflow import FlowSpec, step
class HelloFlow(FlowSpec):
@step
def start(self):
print("HelloFlow is starting.")
self.next(self.hello)
@step
def hello(self):
print("Metaflow says: Hi!")
self.next(self.end)
@step
def end(self):
print("HelloFlow is all done.")
if __name__ == "__main__":
HelloFlow()Run the flow
Run the script with the run command. You can also use show to print the flow's structure before running it.
python helloworld.py runScale out and deploy
Once a flow runs locally, follow the Outerbounds infrastructure guide to configure cloud compute and deploy to a production orchestrator. No code changes to the flow itself are required.
Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Prototype an ML pipeline in a notebook or on your laptop, then scale the same code to cloud compute as the dataset grows
- Run large embarrassingly parallel or distributed training jobs across CPUs and GPUs with automatic versioning of runs and artifacts
- Deploy a tested workflow to a production orchestrator with scheduled or event-triggered runs
- Track experiments and reproduce past results across a team working on many ML projects
How Metaflow compares
Metaflow 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. |
| Metaflow | ★ 10.2k | Build and run data science and ML workflows that scale from your laptop to the cloud |