Skip to content
Source
Sign inSign up
TanStack/ai

feat(ai-sandbox-runta): add Runta sandbox provider #2249

OpenSASUKE40(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/2249/headopened View on GitHub

Showing 20 changed files with 37 additions and 4 deletions (loading 16).

x
0 of 20 viewed, 20 left
5 additions and 0 deletions.changeset/runta-sandbox-provider.mdAdded
View file
@@ -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.
24 additions and 1 deletiondocs/sandbox/providers-advanced.mdModified
View file
@@ -362,6 +362,28 @@
- Blocking `exec` runs without a durable session. If the connection drops, the command dies.
- `kill()` and an aborted `exec` send `TERM` to the process group, then `KILL` after 2 s. An aborted `spawn` sends `KILL` at once. All of them finish only on the confirmed remote exit. An aborted `exec` resolves with the exit code of the signal.
​
+## 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.