Skip to content

Add Sandbox provider with SandboxExecutor, SandboxOperator and @task.sandbox#68847

Open
zozo123 wants to merge 2 commits into
apache:mainfrom
zozo123:add-sandbox-provider
Open

Add Sandbox provider with SandboxExecutor, SandboxOperator and @task.sandbox#68847
zozo123 wants to merge 2 commits into
apache:mainfrom
zozo123:add-sandbox-provider

Conversation

@zozo123

@zozo123 zozo123 commented Jun 22, 2026

Copy link
Copy Markdown

Follows up #68845.

What

Adds a new Sandbox provider (apache-airflow-providers-sandbox) for running Airflow tasks in ephemeral cloud sandboxes behind a pluggable backend layer (a local subprocess reference backend + Daytona, E2B, Modal, islo). Three entry points, smallest-blast-radius first:

  • SandboxOperator and @task.sandbox (mirrors @task.bash) — run one command in a sandbox from a normal task; no special executor required.
  • SandboxExecutor — route every task instance through a sandbox (implements the public BaseExecutor interface only; no core changes, per AIP-51).

Why

There is no executor/operator today targeting ephemeral cloud sandboxes — strong per-task isolation and a serverless execution model without standing up Celery/K8s. The motivating use case is running untrusted / LLM-generated code (agents): a fresh disposable environment per task, with model credentials injected into the sandbox only.

Verification

  • SandboxOperator and @task.sandbox are verified end-to-end on Airflow 3.1 via airflow dags test on the local backend, including credential injection.
  • Every SaaS backend's SDK call sites are checked against the real daytona/e2b/modal/islo SDKs by scripts/verify_sdk_conformance.py (reference repo) — 49/49.
  • Unit tests for the backend contract, the executor watcher logic, the operator, and islo wiring (17 passing); ruff clean.

Reference implementation, design notes and the runnable demo: https://github.com/zozo123/airflow-provider-sandbox

Process / asks

I'm aware new community providers go through ACCEPTING_PROVIDERS.rst (working impl + tests/docs + system-test plan + ≥2 stewards + a committer sponsor, via a dev@ [DISCUSS] lazy-consensus). I'm opening this to anchor the discussion against working code and am happy to take it to the devlist and/or ship it as a third-party package if that's preferred. Seeking steward/sponsor interest. Some breeze-generated artifacts (pyproject/get_provider_info/dependency sync) will need a regen pass by a committer.

  • No AIP needed — implements the public BaseExecutor interface only, no core/API/scheduler changes (AIP-51).
Was generative AI tooling used to co-author this PR?
  • Yes — Claude (Anthropic). All generated code was reviewed and understood by me; tests pass locally and the SaaS SDK call sites were verified against the real SDKs. I take full responsibility for the contribution per the Gen-AI guidelines.

zozo123 added 2 commits June 22, 2026 18:07
Add the apache-airflow-providers-sandbox provider whose SandboxExecutor runs
each task instance in an ephemeral cloud sandbox behind a pluggable backend
layer (local subprocess reference backend plus Daytona, E2B, Modal, islo).

It implements the public BaseExecutor interface only, with no core changes
(AIP-51), and follows the Airflow 3 Task SDK / EdgeExecutor topology: the
in-sandbox supervisor heartbeats and ships logs to the api-server while the
executor reconciles terminal exit state from a polling watcher that
distinguishes a transient UNKNOWN from a confirmed GONE, so a single failed
poll never kills a healthy task. remote_logging is enforced at start();
get_task_log is a documented best-effort fallback. Adoption uses deterministic,
labelled sandbox names where the backend supports reattach.

Includes provider.yaml (executors registration), get_provider_info, unit tests
for the backend contract and the watcher logic, docs, and the boring-cyborg
label mapping.

Relates to: apache#68845

Generated-by: Claude (Anthropic)
Signed-off-by: zozo123 <yossi.eliaz@incredibuild.com>
Add a SandboxOperator and a @task.sandbox TaskFlow decorator (mirroring
@task.bash) that run a command in an ephemeral sandbox from a normal task —
the executor-free way to adopt sandboxes, verified end-to-end on Airflow 3.
Register the decorator via the provider's task-decorators.

Switch the e2b backend to the Sandbox.create() classmethod and rewrite the
islo backend against the real islo SDK (sandboxes resource: create_sandbox/
exec_in_sandbox/get_exec_result/delete_sandbox, name-keyed, pause/resume).
Add operator and islo unit tests.

Generated-by: Claude (Anthropic)
Signed-off-by: zozo123 <yossi.eliaz@incredibuild.com>
@boring-cyborg

boring-cyborg Bot commented Jun 22, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant