feat(ai-sandbox-runta): add Runta sandbox provider #2249
Open
SASUKE40(GitHub profile, opens in a new tab)wants to merge 5 commits into
main fromrefs/pull/2249/head·opened View on GitHubShowing 20 changed files with 37 additions and 4 deletions (loading 16).
x
@@ -0,0 +1,5 @@
+---
+'@tanstack/ai-sandbox-runta': minor
+---
+
+Add the Runta sandbox provider. `runtaSandbox()` runs a harness adapter inside a [Runta](https://runta.com) microVM runtime. It supports a writable stdin, killable processes, published ports, and snapshots that restore into a new runtime.
@@ -362,6 +362,28 @@
+## Runta
+
+```ts
+import { runtaSandbox } from '@tanstack/ai-sandbox-runta'
+
+const runta = runtaSandbox({ apiKey: process.env.RUNTA_TOKEN })
+```
+
+- **Isolation:** a managed [Runta](https://runta.com) runtime. It is a remote microVM that you do not run.
+- **Auth and env:** needs `RUNTA_TOKEN` (or `apiKey`). Set `apiUrl` or `RUNTA_ENDPOINT` for another API endpoint. Inject harness credentials as workspace secrets.
+- **Image and size:** the default image is Ubuntu with `bash`, `git`, and `python3`. It has no Node.js. Pass another image id with `image`, and set the size with `vcpus` and `memoryMib`.
+- **Processes:** `spawn()` opens one WebSocket for each process. A background process gets a writable stdin and separate stdout and stderr.
+- **Bridge:** a remote VM, so bridged tools need the tunnel in local dev. See [Tools](./tools).
+
+Lifecycle and limits:
+
+- **Idle:** a runtime runs until you destroy it. Set `idleSuspendAfterSecs` to suspend an idle runtime. A suspended runtime keeps its disk, and resume by id starts it again.
+- **Snapshot and restore:** `snapshot()` creates a Runta checkpoint of the disk, the memory, and the processes. `restoreSnapshot()` creates a new runtime from the checkpoint. So a snapshot survives deletion of the runtime that made it.