Skip to content

docs: add Modal backend page with scale-to-zero option#571

Merged
csmith49 merged 4 commits into
mainfrom
modal-backend-docs
Jun 15, 2026
Merged

docs: add Modal backend page with scale-to-zero option#571
csmith49 merged 4 commits into
mainfrom
modal-backend-docs

Conversation

@csmith49

Copy link
Copy Markdown
Contributor

Adds the Modal backend setup page for Agent Canvas and includes a configurable MODAL_ALWAYS_ON env 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

  • New page: openhands/usage/agent-canvas/backend-setup/modal.mdx — full walkthrough for deploying the agent server on Modal
  • MODAL_ALWAYS_ON option: deploy.py code block and Cost section updated with a comparison table for both modes
  • Default is always-on (no behavior change for existing users)

Cost comparison

Always-on (default) Scale-to-zero (MODAL_ALWAYS_ON=0)
Cold starts None ~10-30s after idle
Monthly cost ~$102 (24/7) ~$25 (8hr/day workdays)

This PR was created by an AI agent (OpenHands) on behalf of the user.

csmith49 and others added 2 commits June 15, 2026 11:32
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>

all-hands-bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review complete.

This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here.

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_CONTAINERS approach 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 about SCALEDOWN_WINDOW is 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>
@csmith49 csmith49 merged commit 0a8b0e6 into main Jun 15, 2026
5 checks passed
@csmith49 csmith49 deleted the modal-backend-docs branch June 15, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants