Skip to main content

metaflow-sandbox

CI Publish PyPI version Python License: Apache-2.0

Run selected Metaflow steps in fast remote sandboxes (Daytona or E2B) while keeping normal Metaflow behavior for artifacts, retries, and flow state.

Why Use It

  • ⚡ Speed + scale: launch sandboxes in milliseconds (<100ms) and fan out to thousands of containers.
  • 🔒 Isolation: run tool-heavy or untrusted code without polluting the launcher machine.
  • 📦 Dependency management: keep runtime dependencies consistent across local runs, CI, and remote execution.
  • 🧪 Throughput for evals: run many short-lived agent tasks in parallel for benchmark and regression loops.
  • 🔁 Continuity: keep normal step-to-step state and result passing.

Quick Start (Daytona) 🚀

pip install metaflow-sandbox[daytona]

export DAYTONA_API_KEY=...
export METAFLOW_DEFAULT_DATASTORE=s3
export METAFLOW_DATASTORE_SYSROOT_S3=s3://your-bucket/metaflow
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...

python my_flow.py run

Minimal example:

from metaflow import FlowSpec, step, daytona

class Demo(FlowSpec):
    @step
    def start(self):
        self.msg = "hello"
        self.next(self.remote)

    @daytona(cpu=1, memory=2048)
    @step
    def remote(self):
        self.msg = self.msg + " from sandbox"
        self.next(self.end)

    @step
    def end(self):
        print(self.msg)

if __name__ == "__main__":
    Demo()

R2 / S3-Compatible Setup ☁️

For Cloudflare R2, set:

export METAFLOW_S3_ENDPOINT_URL=https://<accountid>.r2.cloudflarestorage.com
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
# optional for R2:
export AWS_DEFAULT_REGION=auto

Dependency Hydration in Sandbox 📦

Use your normal Metaflow decorators:

@daytona
@pypi(packages={"pydash": "==8.0.5"})
@step
def pypi_step(self):
    import pydash
    self.x = pydash.camel_case("hello_world")
    self.next(self.conda_step)

@daytona
@conda(libraries={"numpy": "1.26.4"}, python="3.12.12")
@step
def conda_step(self):
    import numpy as np
    print(self.x, int(np.array([1, 2, 3]).sum()))

Backends 🔌

  • Daytona: pip install metaflow-sandbox[daytona], use @daytona
  • E2B: pip install metaflow-sandbox[e2b], use @e2b
  • Generic: @sandbox(backend="daytona", cpu=2, memory=4096)

Configuration 🧭

For the full list of decorator parameters, environment variables, defaults, and advanced toggles, see docs/configuration.md.

Troubleshooting 🛠️

  • Symptom: auth error from backend API

  • Fix: set the right key (DAYTONA_API_KEY or E2B_API_KEY) in the shell that runs the flow.

  • Symptom: @sandbox/@daytona says remote datastore is required

  • Fix: set METAFLOW_DEFAULT_DATASTORE and its remote datastore root.

  • Symptom: datastore access errors (403, missing objects, endpoint errors)

  • Fix: verify cloud credentials and endpoint config (METAFLOW_S3_ENDPOINT_URL for R2/custom S3).

Development 🧪

ruff check src/ tests/
pytest tests/unit/ tests/structural/
pytest tests/integration/ -m integration

Architecture details: docs/architecture.md
Backend interface: docs/adding-a-backend.md

License

Apache License 2.0. See LICENSE.

Metadata

Release files for metaflow-sandbox 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metaflow-sandbox 0.1.1
File Size Uploaded Provenance
metaflow_sandbox-0.1.1.tar.gz 36.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for metaflow-sandbox 0.1.1
File Interpreter ABI Platform
metaflow_sandbox-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 64.1 kB

Release files / metaflow_sandbox-0.1.1.tar.gz

Download URL metaflow_sandbox-0.1.1.tar.gz
Size 36.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7c6f029d0b9d3aa60e29928f2aea1b0a72814c8c0388e043f014f37ec8d0fb06
BLAKE2b-256 checksum
How to use checksums
d9b7033bad507d622534795aca5ed8131e54f70b96bb70dab975be4e53daa2f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 26, 2026.

Transparency log

Release files / metaflow_sandbox-0.1.1-py3-none-any.whl

Download URL metaflow_sandbox-0.1.1-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ffdee37bfc465063832a2574c08c5fdac6646807c48400cb022d6c1250fc17a
BLAKE2b-256 checksum
How to use checksums
85bac3f1b40752d27dcd38dbcb8595cf67768d8668203f0ab65ab5429337bebd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 26, 2026.

Transparency log

Security for metaflow-sandbox 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for metaflow_sandbox-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page