Skip to content

feat: add tensorlake sandbox - #1555

Open
cooltx7eel wants to merge 1 commit into
openenv:mainfrom
tensorlakeai:feat/tensorlake-sandbox
Open

cooltx7eel wants to merge 1 commit into
openenv:mainfrom
tensorlakeai:feat/tensorlake-sandbox

Conversation

@cooltx7eel

@cooltx7eel cooltx7eel commented Nov 3, 2026 •

Copy link
Copy Markdown

Summary

Adds TensorlakeProvider, a ContainerProvider that runs an environment server in a Tensorlake sandbox and returns a public HTTPS base_url for EnvClient. It is an optional extra (pip install openenv[tensorlake]) with a lazy SDK import, and follows the same keep-alive-then-launch approach as the Modal, Daytona and Novita providers. Also adds tests, an echo-env example, and docs entries.

  • The sandbox URL is public, so the caller must pass public=True to accept that.
  • Egress to the cloud metadata range 169.254.0.0/16 is always blocked. allow_out and deny_out control the rest.
  • Server output is withheld from errors unless the caller passes surface_server_logs=True.
  • Import from openenv.core.containers.runtime.tensorlake_provider. It is not re-exported, same as KubernetesProvider.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • New environment
  • Refactoring

Alignment Checklist

Before submitting, verify:

  • I have read .claude/docs/PRINCIPLES.md and this PR aligns with our principles
  • I have checked .claude/docs/INVARIANTS.md and no invariants are violated
  • I have run /pre-submit-pr (or bash .claude/hooks/lint.sh and tests) and addressed all issues

RFC Status

  • Not required (bug fix, docs, minor refactoring)
  • RFC exists: #___
  • RFC needed (will create before merge)

Test Plan

  • PYTHONPATH=src:envs uv run pytest tests/test_core/test_tensorlake_provider.py: 24 passed, no Tensorlake account needed. The tests use a fake SDK and cover the public URL contract, the public=True opt-in, metadata egress blocking, empty allowlist, cleanup after a failed start, cmd override and openenv.yaml discovery, idempotent and retried stop, env var merging, HTTPS enforcement, context-manager exit, and wait_for_ready on dead, healthy, foreign and flaky servers.
  • PYTHONPATH=src:envs uv run pytest tests/test_core/: 586 passed, 20 skipped.
  • ruff check, ruff format --check and usort check on the changed files. The repo-wide usort check and ruff format --check report tests/envs/test_julia_env.py, tests/envs/test_grid_world.py and src/openenv/core/harness/README.md, which are untouched by this PR and already fail on main.
  • Live run against Tensorlake:
    tl sbx image import ghcr.io/huggingface/openenv-echo-env:latest --registered-name echo-env
    TENSORLAKE_API_KEY=... PYTHONPATH=src:envs uv run python examples/tensorlake_echo_env.py
    Expected: the sandbox starts, /health returns 200, echo_message round-trips "Hello, World!", and the sandbox is terminated at exit.
    

Claude Code Review


Note

Medium Risk
New optional integration with public unauthenticated ingress and egress policy knobs; implementation includes careful cleanup and secret redaction but misconfiguration could expose sandbox URLs or leak env vars in logs.

Overview
Adds TensorlakeProvider, a new cloud ContainerProvider that boots a registered Tensorlake sandbox image, replaces the image CMD with a keep-alive entrypoint, launches the OpenEnv server on port 8000 (from openenv.yaml or cmd=), and returns a public HTTPS base_url for EnvClient.

Install via pip install openenv[tensorlake] (lazy SDK import, tensorlake>=0.5.135 to avoid websockets conflicts with core). Security behavior matches other sandbox providers: callers must pass public=True, ingress URLs must be HTTPS, 169.254.0.0/16 egress is always blocked, and optional allow_out / deny_out tune the rest; server logs in errors are redacted unless surface_server_logs=True.

Also adds examples/tensorlake_echo_env.py, a large fake-SDK unit test suite, autodoc/reference entries, and getting-started / runtime-providers docs listing the tensorlake extra.

Reviewed by Cursor Bugbot for commit c301d0e. Bugbot is set up for automated code reviews on this repo. Configure here.

This branch has not been deployed

No deployments
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