Skip to content

feat: add Tenki Cloud compute provider#1

Open
rishijoshi wants to merge 4 commits into
mainfrom
feat/tenki-compute-provider
Open

feat: add Tenki Cloud compute provider#1
rishijoshi wants to merge 4 commits into
mainfrom
feat/tenki-compute-provider

Conversation

@rishijoshi

Copy link
Copy Markdown
Owner

What & why

PraisonAI already ships compute providers for E2B, Daytona, Modal, Fly.io, Docker and local (one file per vendor in integrations/compute/). This adds Tenki Cloud as another option — disposable Linux microVMs — so managed-agent tools can run in Tenki sandboxes.

What it does

  • TenkiCompute implements the full ComputeProviderProtocol (provision / execute / shutdown / get_status / upload_file / download_file / list_instances), running tools in ephemeral Tenki microVMs. Sync SDK wrapped in run_in_executor, exactly like DaytonaCompute/E2BCompute.
  • Registered as "tenki" in the compute barrel (__init__.py), the _resolve_compute factory (managed_local.py), and the provider hint sets (managed_agents.py, hosted_agent.py).
  • Enabled via TENKI_API_KEY; optional tenki extra (tenki-sandbox). Auto-resolves workspace/project from the key.

Feature scope

Uses only stable Tenki features — ephemeral exec + file I/O (base64 over exec). No volume/snapshot/template. The default stock image ships python3; pip packages are installed on demand (config.packages). Set config.metadata["tenki_image"] to use a prebaked image instead.

Testing

  • Unit tests (no creds): importable, provider_name, is_available, protocol methods, nonexistent-instance handling, and the barrel export — mirroring the E2B/Daytona suites in test_cloud_compute.py.
  • Live integration tests (skipped unless TENKI_API_KEY is set): provision → execute → file upload/download → shutdown, plus pip-install.
  • Validated live end-to-end against real Tenki: provisioned a microVM, pip-installed pandas on the stock image and ran it, round-tripped files, and shut down cleanly with no leaked sandbox.

Add Tenki Cloud (https://tenki.cloud) as a compute provider for managed
agents, alongside E2B, Daytona, Modal, Fly.io, Docker and local.

- TenkiCompute implements ComputeProviderProtocol (provision / execute /
  shutdown / get_status / upload_file / download_file / list_instances),
  running tools in disposable Tenki microVMs. Sync SDK wrapped via
  run_in_executor, matching the existing providers.
- Registered as "tenki" in the compute barrel, the _resolve_compute factory,
  and the compute-provider hint sets.
- Uses only stable Tenki features (exec + file I/O). Default stock image
  installs pip packages on demand; set metadata["tenki_image"] for a custom
  image. Auto-resolves workspace/project from the API key.
- Enabled via TENKI_API_KEY; optional `tenki` extra (tenki-sandbox).
- Unit + live (skipped-by-default) tests mirroring the E2B/Daytona suites.
@rishijoshi

Copy link
Copy Markdown
Owner Author

cc @camcalaquian — opened in my fork per your note (holding upstream for your review gate). Adds Tenki as a 7th compute provider alongside E2B/Daytona/Modal/Fly.io/Docker/local (both E2B & Daytona already in-tree, per the 'prioritize competitor-integrated repos' steer). Stable features only (exec + file I/O), no volume/snapshot. Validated live vs real Tenki: provision + pandas pip-install + exec + file round-trip + clean teardown.

@camcalaquian camcalaquian left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

overall lgtm. once the version is updated let's work on getting this to upstream

Comment thread src/praisonai/pyproject.toml Outdated
# Install via: pip install git+https://github.com/daytonaio/daytona-python
]
tenki = [
"tenki-sandbox>=0.3",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we make the version >=0.3.6

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Done in 9354602 — bumped to tenki-sandbox>=0.3.6. Ready for the upstream step whenever you are.

@camcalaquian

Copy link
Copy Markdown

@rishijoshi sorry there was another release of sdk yesterday, let's update to that and submit this PR to upstream.

@rishijoshi

Copy link
Copy Markdown
Owner Author

@camcalaquian thanks! Quick check before I bump — PyPI's latest tenki-sandbox is still 0.3.6 (uploaded 2026-07-10), which is what this PR already pins (>=0.3.6). I don't see a newer release there yet — checked including pre-releases, and pip index versions agrees (only 0.1.0 / 0.1.1 / 0.3.5 / 0.3.6). The tenki CLI is separately at v0.16.0, but that's not the pyproject dep.

Could you point me at the new version (or where it's published)? As soon as it's on PyPI I'll bump tenki-sandbox here (and in the khoj PR), re-lock, re-validate, and open the upstream PR.

@camcalaquian

Copy link
Copy Markdown

seems the updated sdk wasn't posted immediately, you should see the updated sdk now on pypi

@rishijoshi

Copy link
Copy Markdown
Owner Author

0.4.0 landed on PyPI (2026-07-17) — bumped to tenki-sandbox>=0.4.0 (68c8ebf) and re-validated live against 0.4.0 (sync Client path: provision + exec + teardown, green). Submitted upstream: MervinPraison#3242.

…eanup)

The maintainer's review bot flagged these but couldn't push to a fork, so
applying directly:
- Raise on a configured-but-unknown TENKI_WORKSPACE_ID/PROJECT_ID instead of
  silently using the first workspace/project (wrong-workspace billing).
- shlex.quote every pip/npm spec (command-injection hardening).
- Honour a non-default ComputeConfig.image, not just metadata["tenki_image"].
- Respect ComputeConfig.networking (restricted -> allow_outbound=False).
- Fail provisioning and tear down the sandbox when package install fails
  (no false RUNNING / leaked sandbox).
- Terminate before dropping the handle in shutdown, so a failed terminate keeps
  the sandbox tracked for retry instead of silently leaking it.
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