Skip to content

Add Vercel sandbox environment support#145

Open
taivu1998 wants to merge 1 commit into
alexzhang13:mainfrom
taivu1998:codex/vercel-sandbox-support
Open

Add Vercel sandbox environment support#145
taivu1998 wants to merge 1 commit into
alexzhang13:mainfrom
taivu1998:codex/vercel-sandbox-support

Conversation

@taivu1998

Copy link
Copy Markdown

Summary

This PR adds first-class Vercel Sandbox support as a new isolated RLM environment.

What’s included

  • Add VercelREPL in rlm/environments/vercel_repl.py
  • Register environment="vercel" in the environment factory and EnvironmentType
  • Add a vercel optional dependency extra in pyproject.toml
  • Add README guidance for Vercel Sandboxes and clarify the distinction between:
    • backend="vercel" for AI Gateway
    • environment="vercel" for Vercel Sandboxes
  • Add examples/vercel_repl_example.py
  • Add focused mocked test coverage for the new environment

Design

The implementation follows the existing isolated-environment pattern already used by Modal/Prime/Daytona/E2B:

  • Create a Vercel Sandbox with explicit python3.13
  • Start a lightweight HTTP broker inside the sandbox
  • Poll broker requests from the host
  • Forward LM requests through LMHandler
  • Return responses back into the sandbox
  • Preserve REPL locals across iterations within a single completion

Notable v1 choices:

  • persistent=True is explicitly unsupported
  • rlm_query(...) and rlm_query_batched(...) are exposed in the sandbox as thin aliases over the llm_query variants
  • The broker and sandbox helper path use stdlib HTTP utilities instead of Flask/requests inside the sandbox, which keeps Vercel startup simpler
  • Broker HTTP error payloads are preserved so timeout/error messages surface cleanly

Files changed

  • rlm/environments/vercel_repl.py
  • rlm/environments/__init__.py
  • rlm/core/types.py
  • pyproject.toml
  • README.md
  • examples/vercel_repl_example.py
  • tests/test_vercel_repl.py
  • tests/test_imports.py
  • tests/test_multi_turn_integration.py

Verification

Ran:

  • .venv/bin/ruff check rlm/environments/vercel_repl.py tests/test_vercel_repl.py tests/test_imports.py tests/test_multi_turn_integration.py examples/vercel_repl_example.py
  • .venv/bin/ruff format --check rlm/environments/vercel_repl.py tests/test_vercel_repl.py tests/test_imports.py tests/test_multi_turn_integration.py examples/vercel_repl_example.py
  • .venv/bin/python -m compileall rlm/environments/vercel_repl.py examples/vercel_repl_example.py tests/test_vercel_repl.py
  • .venv/bin/pytest tests/test_vercel_repl.py tests/test_imports.py tests/test_types.py tests/test_multi_turn_integration.py::TestPersistentModeValidation::test_vercel_environment_raises_error

Result:

  • 63 passed, 4 skipped

Notes

I did not run the full socket-heavy integration suite in this environment because localhost socket binds for LMHandler are blocked here with PermissionError: [Errno 1] Operation not permitted. The new Vercel-specific coverage and public-surface checks are passing.

@taivu1998

Copy link
Copy Markdown
Author

Hi @alexzhang13, could you help review it when you have time? Thanks!

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.

1 participant