Skip to content

feature: Add TensorLake MicroVM Sandbox environment#1237

Merged
alexgshaw merged 18 commits into
harbor-framework:mainfrom
tensorlakeai:aj/tensorlake-environment
Apr 20, 2026
Merged

feature: Add TensorLake MicroVM Sandbox environment#1237
alexgshaw merged 18 commits into
harbor-framework:mainfrom
tensorlakeai:aj/tensorlake-environment

Conversation

@ajjimeno

@ajjimeno ajjimeno commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Add TensorLake MicroVM Sandbox as a new execution environment, enabling Harbor benchmark runs to be distributed across TensorLake's cloud infrastructure with support for high concurrency, GPU access, and optional internet isolation.

Context

Harbor supports multiple sandbox environment backends (E2B, Modal, Runloop, GKE, Daytona, Apple Container) to allow agents to execute tasks in isolated compute environments. TensorLake's sandbox offering provides ubuntu:24.04-based MicroVM sandboxes with a simple SDK that fits the same lifecycle interface. Adding it as a first-class environment lets users of the TensorLake platform run benchmarks without needing to provision their own Kubernetes or cloud infrastructure.

Changes

  • Added TensorLakeEnvironment class implementing the full BaseEnvironment interface: start, stop, exec, upload_file, upload_dir, download_file, download_dir, is_dir, is_file, and attach
  • Added TensorLakeClientManager singleton to share a single SandboxClient across all concurrent environment instances, with automatic cleanup at program exit
  • Registered TensorLakeEnvironment in EnvironmentFactory and added TENSORLAKE to the EnvironmentType enum
  • Added tensorlake>=0.4.20 as a project dependency
  • Added an integration test covering the full lifecycle: start → exec → file upload → file download → stop/delete

Key Implementation Details

  • Sandbox creation uses create_and_connect() which polls until SandboxStatus.RUNNING before returning, preventing SANDBOX_NOT_RUNNING errors on the first exec() call
  • All synchronous SDK calls are dispatched via loop.run_in_executor to avoid blocking the async event loop during concurrent benchmark runs
  • Retry logic (via tenacity) is applied to sandbox creation, deletion, and file I/O operations
  • force_build=True is accepted for interface parity but emits a warning — TensorLake uses a fixed ubuntu:24.04 base image; custom dependencies must be installed via exec() after start, or via a pre-built snapshot passed as snapshot_id
  • _validate_definition() is overridden to a no-op since no Dockerfile is required
  • attach() delegates to tl sbx ssh <id> for interactive shell access

Use Cases

export ANTHROPIC_API_KEY=<YOUR-KEY>
export TENSORLAKE_API_KEY=<YOUR-KEY>

harbor run --dataset [email protected] \
  --agent claude-code \
  --model anthropic/claude-sonnet-4-6 \
  --n-concurrent 10 \
  --env tensorlake \
  --timeout-multiplier 16.0 \
  --ae CLAUDE_CODE_MAX_OUTPUT_TOKENS=100000 \
  --debug

Testing

# Install dependencies
pip install tensorlake tenacity

# Set API key
export TENSORLAKE_API_KEY="your-api-key"

# Run the integration test (requires a live TensorLake account)
pytest tests/integration/test_tensorlake.py -v -m integration

The integration test covers:

  1. Sandbox start
  2. Command execution (echo round-trip)
  3. File upload and remote read verification
  4. File download and local content verification
  5. Sandbox stop and deletion

Open with Devin

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread README.md
Comment thread src/harbor/environments/factory.py Outdated
Comment thread src/harbor/environments/factory.py Outdated
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@alexgshaw

Copy link
Copy Markdown
Collaborator

Thanks for the PR! Could you run [email protected] with the oracle agent to sanity check the integration? Our threshold is >90%.

devin-ai-integration[bot]

This comment was marked as resolved.

@alexgshaw

Copy link
Copy Markdown
Collaborator

Any update here?

@vercel

vercel Bot commented Apr 11, 2026

Copy link
Copy Markdown

@ajjimeno is attempting to deploy a commit to the Harbor Framework Team on Vercel.

A member of the Team first needs to authorize it.

@ajjimeno

ajjimeno commented Apr 11, 2026 via email

Copy link
Copy Markdown
Contributor Author

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread src/harbor/environments/tensorlake.py Outdated
ajjimeno and others added 13 commits April 17, 2026 09:33
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@ajjimeno
ajjimeno force-pushed the aj/tensorlake-environment branch from c2bbd39 to 4c49744 Compare April 17, 2026 16:41
@ajjimeno

Copy link
Copy Markdown
Contributor Author

@alexgshaw we have been working to enhance our Tensorlake environment. We get the following numbers below with the oracle environment. Checking what is the next steps.

terminal-bench • oracle
┏━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━┓
┃ Trials ┃ Exceptions ┃  Mean ┃
┡━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━┩
│     89 │          0 │ 0.955 │
└────────┴────────────┴───────┘

┏━━━━━━━━┳━━━━━━━┓
┃ Reward ┃ Count ┃
┡━━━━━━━━╇━━━━━━━┩
│ 1.0    │    85 │
│ 0.0    │     4 │
└────────┴───────┘

Also, just a friendly comment just in case, we have been running tests on Daytona and Modal with (0.77 and 0.88) using the oracle environment.

devin-ai-integration[bot]

This comment was marked as resolved.

ajjimeno and others added 2 commits April 17, 2026 17:31
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

@alexgshaw
alexgshaw merged commit 4f53997 into harbor-framework:main Apr 20, 2026
7 of 8 checks passed
harshraj172-scale pushed a commit to harshraj172-scale/harbor that referenced this pull request May 30, 2026
…#1237)

* Cleaned up environment configuration

* Updated pyproject

* Fixed regex

* Update src/harbor/environments/tensorlake.py

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Fix devin linting issue

* Moving tensorlake dependency

* Fix devin linting issue

* Improvements to running tensorlake

* Update src/harbor/environments/tensorlake.py

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Update src/harbor/environments/tensorlake.py

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Update src/harbor/environments/tensorlake.py

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Update src/harbor/environments/tensorlake.py

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Update src/harbor/environments/tensorlake.py

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Linting

* Update pyproject.toml

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Fix cmd

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants