Deploy WATFlow workflows to Modal for scheduled serverless execution.
- Modal account - Sign up at modal.com (free tier available)
- Workflow tested locally - Run
wat run <workflow>first - API keys configured - All required keys in your
.envfile
# Install Modal (first time only)
uv pip install modal
# Authenticate with Modal (opens browser)
modal setup
# Deploy your workflow
wat deploy my-workflowwat deploy my-workflow
│
├─ 1. Generates modal_app.py
│ (Container configuration)
│
├─ 2. Creates Modal secret from .env
│ (API keys stored securely)
│
├─ 3. Deploys to Modal
│ (All files copied to container)
│
└─ 4. Prints success with dashboard URL
LOCAL MODAL CONTAINER
my-workflow/ /root/my-workflow/
├── main.py ────────► ├── main.py
├── config.yaml ────────► ├── config.yaml
├── requirements.txt ────────► ├── requirements.txt
├── tools/ ────────► ├── tools/
├── workflows/ ────────► ├── workflows/
├── credentials.json ────────► ├── credentials.json
├── token.json ────────► ├── token.json
│ │
└── .env ──secret──► (env vars injected at runtime)
The .env file is NOT copied directly - its contents become a Modal Secret for security.
Add a deployment section to your workflow's config.yaml:
deployment:
platform: modal
schedule: weekly # daily, weekly, or monthly
schedule_day: sunday # For weekly: monday-sunday
schedule_time: "08:00" # UTC time (24-hour format)
timeout: 1800 # Optional: seconds (default 1800)Omit schedule fields for on-demand only (no automatic runs).
| Command | Description |
|---|---|
wat deploy <name> |
Deploy workflow to Modal |
wat deploy <name> --dry-run |
Generate modal_app.py without deploying |
modal run modal_app.py::run_workflow |
Run deployed workflow once |
modal logs |
View workflow logs |
- Dashboard: https://modal.com/apps/your-workflow-name
- Run manually:
modal run modal_app.py::run_workflow - View logs: Check the Modal dashboard
Simply run wat deploy <name> again. It will:
- Regenerate modal_app.py
- Update the Modal secret with current .env values
- Redeploy with the latest code
uv pip install modalmodal setupCheck the Modal dashboard for error logs. Common issues:
- Missing dependencies in requirements.txt
- Invalid Python syntax in tools
- Missing environment variables
Ensure your .env file exists and contains valid KEY=value pairs.
Modal pricing is based on compute time. A typical workflow running weekly:
- ~30 seconds of compute time per run
- Well within free tier limits
See Modal pricing for details.