Tenki
Tenki Cloud provider for ComputeSDK - microVM sandboxes with native filesystem, preview URLs, snapshots, and SSH.
Lifecycle
pause()/resume() preserve memory and processes. Snapshot methods create/list/delete are exposed directly. Snapshots preserve rootfs and memory and keep the source; the adapter notes that Tenki empties /tmp on the source during capture. Keep durable state outside /tmp (the declared path is /home/tenki). Restore with snapshotId.
Installation & Setup
npm install @computesdk/tenkiRequires Node.js 20 or later (the Tenki SDK's gRPC transport depends on it).
Add your Tenki credentials to a .env file:
TENKI_API_KEY=tk_your_api_keyUsage
import { tenki } from '@computesdk/tenki';
const compute = tenki({
apiKey: process.env.TENKI_API_KEY,
});
// Create sandbox
const sandbox = await compute.instances.create();
// Run a command
const result = await sandbox.runCommand('echo "Hello from Tenki!"');
console.log(result.stdout); // "Hello from Tenki!"
// Clean up
await sandbox.destroy();Configuration Options
Supported Operations
create
✅
Boots a microVM in the resolved workspace/project; accepts per-call cpuCores/memoryMb/diskSizeGb overrides.
getById
✅
Resolves a session by id; returns null for unknown/invalid ids.
list
✅
Lists sessions for the API key.
destroy
✅
Closes the session (no-op if already gone).
runCommand
✅
Wrapped in sh -lc so pipes, globs, and env expansion work; supports cwd, env, timeout, background, and stdout/stderr streaming.
getInfo
✅
getUrl
✅
Exposes a port and returns its public preview URL (e.g. https://<slug>.sb.tenki.sh).
filesystem
✅
Native data-plane file API (readFile, writeFile, mkdir, readdir, remove); exists uses test -e for consistency.
Notes
Workspace API keys infer their workspace server-side. Set
workspaceId, orTENKI_WORKSPACE_ID, only when using trusted service credentials that require explicit scope.Background commands (
{ background: true }) detach stdio automatically; a bare&would hold the exec output stream open.Snapshots and pause/resume are wired to the unified surface. Use
sandbox.getInstance()for additional native SDK controls such as SSH, tunnels, and git.
Last updated
Was this helpful?