docs: add Modal backend page with scale-to-zero option#571
Conversation
Update the Modal backend page with configurable always-on vs scale-to-zero mode. Default behavior unchanged (always warm). Set MODAL_ALWAYS_ON=0 at deploy time to scale to zero when idle (~$25/month vs ~$102/month, with ~10-30s cold starts). - Updated deploy.py code block with MODAL_ALWAYS_ON env var - Rewrote Cost section with comparison table for both modes - Added scale-to-zero deploy command in step 3 Co-authored-by: openhands <openhands@all-hands.dev>
- Update 'When to Use It' to mention scale-to-zero option - Add scaledown_window tuning tip for scale-to-zero users - Add Upgrading section (how to bump the image tag) - Add Troubleshooting section (logs, app list, redeploy) Co-authored-by: openhands <openhands@all-hands.dev>
3cb6858 to
f6121a5
Compare
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
Code Review: Modal Backend Documentation with Scale-to-Zero
🟢 Good taste — Clean, minimal implementation that solves a real cost optimization problem without complexity.
Summary
This PR adds a MODAL_ALWAYS_ON environment variable to the Modal backend deploy script and updates the documentation with a cost comparison between always-on and scale-to-zero modes. The change is backward-compatible (default preserves existing behavior) and the documentation is thorough.
Observations
Python code (lines 76-101 of the diff):
- The
os.environ.get()pattern with.lower() in ("1", "true")handles environment variable parsing idiomatically - The conditional
MIN_CONTAINERSapproach is clean and avoids special-casing throughout the code - Comments clearly explain the trade-offs without being verbose
Documentation quality:
- Cost comparison table is well-structured
- The
<Tip>block aboutSCALEDOWN_WINDOWis a nice touch for users who want to tune behavior - "Upgrading" and "Troubleshooting" sections add practical value
Minor Suggestions
🟡 Suggestion: The scale-to-zero cost estimate ("~$25/month") could benefit from a note clarifying the calculation basis. "8hr/day on workdays" implies 20 workdays/month = 160 hours/month × ~$0.14/hr ≈ $22.40. A brief note would help users who want to estimate their own usage patterns.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Documentation-only change with a small, backward-compatible config addition. No breaking changes to existing deployments.
VERDICT:
✅ Worth merging: Clean implementation, solves a real problem, well-documented.
KEY INSIGHT:
The conditional container configuration (MIN_CONTAINERS = 1 if ALWAYS_ON else 0) is an elegant way to handle the always-on vs scale-to-zero trade-off without duplicating deployment logic.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation.
| @@ -218,15 +238,32 @@ Settings are stored server-side on the Modal volume (encrypted with `OH_SECRET_K | |||
|
|
|||
There was a problem hiding this comment.
🟡 Suggestion: Consider adding a note clarifying the "~$25/month" calculation basis (e.g., "assuming 8 hours/day on workdays"). Users may want to estimate costs for different usage patterns.
Bare $ in prose and table cells was being parsed as inline math delimiters, causing text like '/day' to render as italicized math. Co-authored-by: openhands <openhands@all-hands.dev>
Bare ~ characters were being paired as strikethrough markers. Co-authored-by: openhands <openhands@all-hands.dev>
Adds the Modal backend setup page for Agent Canvas and includes a configurable
MODAL_ALWAYS_ONenv var that lets users choose between always-on ($102/month, no cold starts) and scale-to-zero ($25/month, ~10-30s cold start after idle).Changes
openhands/usage/agent-canvas/backend-setup/modal.mdx— full walkthrough for deploying the agent server on ModalMODAL_ALWAYS_ONoption: deploy.py code block and Cost section updated with a comparison table for both modesCost comparison
MODAL_ALWAYS_ON=0)This PR was created by an AI agent (OpenHands) on behalf of the user.