feat(sandbox-tenki): add Tenki sandbox provider

MO
4mo ago
+4135-134

PR Checklist

Bugs / Features

What is the current behavior?

VoltAgent ships first-party workspace sandbox providers for Blaxel, Daytona, and E2B. There is none for Tenki, so anyone who wants agents to run shell commands in Tenki microVMs has to implement WorkspaceSandbox themselves.

What is the new behavior?

Adds @voltagent/sandbox-tenki, a WorkspaceSandbox implementation backed by @tenkicloud/sandbox, mirroring the existing E2B / Blaxel / Daytona providers. Each TenkiSandbox lazily provisions one disposable Tenki Linux microVM and reuses it across every execute_command:

  • streaming stdout/stderr, with maxOutputBytes truncation on UTF-8 codepoint boundaries
  • per-call timeoutMs and AbortSignal, enforced by killing the remote process
  • native cwd / env / stdin forwarding
  • start() / stop() / destroy() with serialized lifecycle transitions; a paused session is resumed (and timeout/abort re-checked) before a command runs
  • getSandbox() for direct SDK access (filesystem, port exposure, SSH), plus getInfo() / getInstructions() for the workspace toolkit
  • createTenkiToolkit(sandbox) — optional expose_preview_url and authorize_ssh_key tools on the same session, isolated in tools.ts so they can be dropped without touching the adapter

No changes to @voltagent/core. Also included: a package README, a ### Tenki section plus provider-table row in website/docs/workspaces/sandbox.md, and a minor changeset.

Notes for reviewers

  • Disclosure: I work with Tenki team.

  • CI: no sandbox provider is currently in the test-packages matrix, so this suite (like sandbox-blaxel's) will not run upstream. I deliberately left the workflow files untouched — adding sandbox-tenki to release.yml would make it a gate on publish, which isn't my call. Glad to add all four providers to the matrix in a follow-up if you'd like them there.

  • E2E Tests runs rather than skips on this PR because its path filter matches pnpm-lock.yaml. Nothing here touches an e2e input.

  • Validation: 133 tests, 100% line/branch/function/statement coverage (SDK fully mocked — no network, no credentials), plus pnpm install --frozen-lockfile, pnpm lint:ci, pnpm sp lint, pnpm build:all, pnpm publint:all, typecheck, and commitlint. No live microVM run — there is no TENKI_API_KEY in this environment.


Summary by cubic

Add @voltagent/sandbox-tenki, a new sandbox provider that runs agent commands in disposable Tenki Linux microVMs via @tenkicloud/sandbox. Adds Tenki alongside E2B, Blaxel, and Daytona, with lifecycle and output handling tuned for reliability.

  • New Features

    • Implements WorkspaceSandbox with one lazily provisioned Tenki session reused across commands; serialized start/stop/destroy with a bounded resume timeout.
    • Streams stdout/stderr with UTF‑8–safe truncation (maxOutputBytes), per‑call timeoutMs and AbortSignal, and native cwd/env/stdin forwarding.
    • Escape hatch via getSandbox() and workspace metadata; optional createTenkiToolkit() with expose_preview_url and authorize_ssh_key (validates a single‑line authorized_keys entry).
  • Bug Fixes

    • Prevent lifecycle stalls by releasing the queue when a canceled execute abandons resume().
    • Prefer the run’s aggregate output if a stream pump dies and propagate truncation flags; collapse CR/LF in Tenki “reason” to a single‑line diagnostic.
    • Docs: add Tenki to the sandbox guide and note TENKI_AUTH_TOKEN as an alternative credential.

Summary by CodeRabbit

  • New Features

    • Added Tenki as a remote workspace sandbox provider using disposable Linux microVMs.
    • Supports streamed output, timeouts, cancellation, environment and directory settings, input forwarding, and output limits.
    • Added lifecycle controls, preview URL exposure, SSH key authorization, and direct session access.
    • Added the @voltagent/sandbox-tenki package and optional preview URL and SSH tools.
  • Documentation

    • Added setup guidance, configuration examples, credential handling, workspace selection, and cleanup recommendations for Tenki sandboxes.