---
title: "Run GPU jobs from Airflow with Modal"
description: "Airflow DAGs can offload GPU-heavy tasks to Modal instead of standing up Celery or Kubernetes executors, using a two-step pipeline that scrapes Reddit ELI5 questions and answers them with an LLM as the example."
url: "https://swe.quest/articles/run-gpu-jobs-from-airflow-with-modal-53fdd2aef1aa5c6f"
canonical: "https://modal.com/blog/modal-airflow"
source: "Modal"
published: "2024-06-20"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["data-pipelines","scheduling","serverless","python","ml-platform"]
---

# Run GPU jobs from Airflow with Modal

A post on [Modal](https://swe.quest/sources/modal.md), published 2024-06-20, 7 min read, How-to. Original: [https://modal.com/blog/modal-airflow](https://modal.com/blog/modal-airflow)

## Summary

Airflow DAGs can offload GPU-heavy tasks to Modal instead of standing up Celery or Kubernetes executors, using a two-step pipeline that scrapes Reddit ELI5 questions and answers them with an LLM as the example. One approach deploys Modal Functions separately and calls them from Airflow tasks via Function.from\_name and remote(), passing intermediate data through a Modal Dict (10GB limit versus roughly 1GB for XComs on Postgres) or a Volume. The other defines a custom ModalOperator that serializes a Python function's source and runs it in a Modal Sandbox with a runtime-defined image, secrets, volumes and GPUs. Either way, task environments stay isolated from the Airflow environment without building Docker images for KubernetesPodOperator.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Data pipelines](https://swe.quest/tags/data-pipelines.md) (Data & databases)
- [Scheduling](https://swe.quest/tags/scheduling.md) (Distributed systems)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Python](https://swe.quest/tags/python.md) (Languages)
- [ML platforms](https://swe.quest/tags/ml-platform.md) (AI & ML)

## Prerequisites

- Apache Airflow DAGs and operators ([easy posts on Data pipelines](https://swe.quest/tags/data-pipelines.md?difficulty=easy))
- Python ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))

## Keywords

Apache Airflow, Modal, Astro CLI, Astronomer, Modal Sandboxes, KubernetesPodOperator, XComs

## Related posts

- [Autoscaling Autoresearch: Give your agents elastic GPUs on Modal](https://swe.quest/articles/autoscaling-autoresearch-give-your-agents-elastic-gpus-on-modal-149826d2e84207c1.md): Modal · 2026-04-14 · Medium · 8 min read · AI agents, ML platforms, Serverless, Model training, Capacity planning
  A Claude Code agent equipped with Modal Skills ran OpenAI's Parameter Golf challenge overnight, executing 113 experiments over 238 GPU-hours and dropping bits-per-byte from 1.42 to 1.12.
- [Building with Modal and the OpenAI Agents SDK](https://swe.quest/articles/building-with-modal-and-the-openai-agents-sdk-c24777075f600dcf.md): Modal · 2026-04-15 · Medium · 12 min read · AI agents, Sandboxing & isolation, LLMs, Python, Cloud platforms
  A custom agent harness built on the OpenAI Agents SDK runs coding agents inside Modal Sandboxes, optionally with GPUs, rather than on the host, where an unsandboxed exec tool can be abused by malicious prompts.
- [Wire It, Run It, Deploy It: AI Workflows in Gradio](https://swe.quest/articles/wire-it-run-it-deploy-it-ai-workflows-in-gradio-cb75b6e96a2edb26.md): Hugging Face · 2026-08-25 · Medium · 5 min read · Developer tools, Python, Machine learning, API design
  Gradio's gr.Workflow turns AI pipelines into a graph of typed nodes (reference inputs, operator steps, subject outputs) served as a drag-and-drop canvas where every node is runnable and intermediate results are visible.
- [Augment Your LiveKit Agent with Modal GPUs](https://swe.quest/articles/augment-your-livekit-agent-with-modal-gpus-7c537d7efe5221b2.md): Modal · 2026-10-15 · Medium · 2 min read · Serverless, Real-time systems, Inference & serving, Speech & audio, Video & media
  LiveKit agents can offload custom or open-weights models to Modal serverless GPUs, demonstrated with a BitHuman Expression video avatar voiced by Qwen3-TTS.
- [How Doppel eliminated ML infrastructure tax with Modal](https://swe.quest/articles/how-doppel-eliminated-ml-infrastructure-tax-with-modal-6cfb61f19c711d02.md): Modal · 2026-03-25 · Medium · 5 min read · ML platforms, Serverless, Inference & serving, Model training, Threat detection
  Doppel, which builds ML models to detect social engineering attacks, moved much of its training and inference from sequential experiments and GCP Cloud Run to Modal.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
