forked from superagent-ai/vibekit
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Tenki sandbox provider (@vibe-kit/tenki) #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ee84de9
feat: add Tenki sandbox provider (@vibe-kit/tenki)
8a1cdb2
harden Tenki provider: fail-fast config, leaked-sandbox id, real agen…
4a35c3f
fix(tenki): create root-owned working dir on non-root image
a8d95bd
docs(tenki): use executeCommand instead of deprecated generateCode
0d5859b
docs(tenki): wrap sandbox usage in try/finally so kill() always runs
a7df3a6
chore(tenki): update @tenkicloud/sandbox to ^0.5.4
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| --- | ||
| title: 'Tenki' | ||
| description: 'Configure VibeKit with Tenki disposable microVM sandboxes' | ||
| --- | ||
|
|
||
| [Tenki](https://tenki.cloud) runs coding agents inside disposable Linux microVMs with per-second billing, public preview URLs, and pause/resume. It is a good fit for VibeKit's "run an agent safely, watch it remotely" workflow, and boots agents on Tenki's default base image with no image maintenance on your side. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install @vibe-kit/tenki | ||
| ``` | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. Sign up for Tenki and create a workspace at [tenki.cloud](https://tenki.cloud). | ||
| 2. Create an API key (prefixed `tk_`) in your account settings. | ||
| 3. Set it as an environment variable: | ||
|
|
||
| ```bash | ||
| export TENKI_AUTH_TOKEN=tk_your_key_here | ||
| ``` | ||
|
|
||
| The SDK also accepts `TENKI_API_KEY` as a fallback. | ||
|
|
||
| ## Configuration | ||
|
|
||
| VibeKit uses a builder pattern with method chaining. Configure your Tenki provider and VibeKit instance: | ||
|
|
||
| ```typescript | ||
| import { VibeKit } from "@vibe-kit/sdk"; | ||
| import { createTenkiProvider } from "@vibe-kit/tenki"; | ||
|
|
||
| // Create the Tenki provider | ||
| const tenkiProvider = createTenkiProvider({ | ||
| apiKey: process.env.TENKI_AUTH_TOKEN!, // optional; falls back to TENKI_AUTH_TOKEN / TENKI_API_KEY | ||
| cpuCores: 2, // optional | ||
| memoryMb: 4096, // optional | ||
| }); | ||
|
|
||
| // Create the VibeKit instance with the provider | ||
| const vibeKit = new VibeKit() | ||
| .withAgent({ | ||
| type: "claude", | ||
| provider: "anthropic", | ||
| apiKey: process.env.ANTHROPIC_API_KEY!, | ||
| model: "sonnet", // alias for the current Sonnet; a pinned dated model can 404 | ||
| }) | ||
| .withSandbox(tenkiProvider) | ||
| .withWorkingDirectory("/var/vibe0") // optional | ||
| .withSecrets({ | ||
| NODE_ENV: "development", | ||
| }); | ||
|
|
||
| // Run a command in the sandbox and read its output | ||
| // (executeCommand is VibeKit's supported entrypoint; generateCode is deprecated) | ||
| const result = await vibeKit.executeCommand("echo 'hello from the sandbox'"); | ||
| console.log(result.stdout); | ||
|
|
||
| // Execute commands in the sandbox | ||
| await vibeKit.executeCommand("npm install && npm test"); | ||
|
|
||
| // Start a dev server in the background and get its public URL | ||
| await vibeKit.executeCommand("npm run dev", { background: true }); | ||
| const url = await vibeKit.getHost(3000); | ||
| console.log(`Service available at: ${url}`); | ||
|
|
||
| // Clean up | ||
| await vibeKit.kill(); | ||
| ``` | ||
|
|
||
| ## Configuration Options | ||
|
|
||
| `createTenkiProvider` accepts: | ||
|
|
||
| ### Optional Options | ||
|
|
||
| - **`apiKey`** (string): your Tenki API key (`tk_…`). Falls back to `TENKI_AUTH_TOKEN`, then `TENKI_API_KEY`. | ||
| - **`baseUrl`** (string): override the Tenki API endpoint (defaults to `https://api.tenki.cloud`). | ||
| - **`workspaceId`** (string): Tenki workspace id. Auto-resolved from your first workspace when omitted. | ||
| - **`projectId`** (string): Tenki project id. Auto-resolved from the workspace's first project when omitted. | ||
| - **`cpuCores`** (number): vCPU cores for the sandbox. | ||
| - **`memoryMb`** (number): memory in MB for the sandbox. | ||
| - **`maxDurationMs`** (number): hard cap on total sandbox lifetime — a backstop so an abandoned sandbox self-terminates. | ||
| - **`idleTimeoutMinutes`** (number): auto-stop after N idle minutes. Keep it longer than your longest single task. | ||
| - **`waitTimeoutMs`** (number): how long `create()` waits for readiness; bounds provisioning independently of per-command timeouts. | ||
| - **`sticky`** (boolean): keep the sandbox persistent/long-lived, enabling reliable `resume`. | ||
| - **`image`** (string | object): boot from a pre-built **Tenki registry** image. This is a Tenki registry reference, **not** a Docker Hub image. When set, the agent CLI is assumed to be pre-installed. | ||
| - **`snapshotId`** (string): boot from a Tenki snapshot. Same skip-install behavior as `image`. | ||
| - **`installAgent`** (boolean): install the requested agent's CLI at create time on Tenki's default base image. Defaults to `true` unless `image`/`snapshotId` is provided. | ||
|
|
||
| ## How it works | ||
|
|
||
| By default the provider boots Tenki's stock base image and installs the requested agent's CLI at create time — `@anthropic-ai/claude-code`, `@openai/codex`, `@google/gemini-cli`, `opencode-ai`, or `@vibe-kit/grok-cli` (the same packages used by the prebuilt VibeKit images). To skip the per-create install, pre-bake those CLIs into a Tenki registry image or snapshot and pass it via `image` / `snapshotId`. | ||
|
|
||
| ## Features | ||
|
|
||
| - Runtime agent-CLI installation on Tenki's default base image (no image maintenance) | ||
| - Optional custom Tenki registry image / snapshot | ||
| - Background command execution with streamed stdout/stderr | ||
| - Preview URLs via exposed ports (`getHost`) | ||
| - Pause / resume of long-lived sandboxes | ||
| - Environment variable injection and custom working directory | ||
|
|
||
| ## ENV variables and secrets | ||
|
|
||
| ```bash | ||
| # Required Tenki credential | ||
| TENKI_AUTH_TOKEN=tk_your_key_here | ||
|
|
||
| # Agent API keys (as needed) | ||
| ANTHROPIC_API_KEY=your_anthropic_key | ||
| OPENAI_API_KEY=your_openai_key | ||
| GEMINI_API_KEY=your_gemini_key | ||
|
|
||
| # Optional GitHub integration | ||
| GITHUB_TOKEN=your_github_token_here | ||
| ``` | ||
|
|
||
| ## System Requirements | ||
|
|
||
| - **Node.js 18+** | ||
| - **Tenki account** with a workspace and API key | ||
|
|
||
| ## Support | ||
|
|
||
| - **Tenki Platform**: [Tenki Documentation](https://tenki.cloud/docs) | ||
| - **VibeKit Integration**: open an issue on [GitHub](https://github.com/superagent-ai/vibekit/issues) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.