docs(community-adapters): add the WBX Sandbox sandbox provider #2276
OpenWBX-Sandbox(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/2276/headopened View on GitHubtanstack-source added labelsdocs
- @@ -0,0 +4,21 @@4+order: 35+description: "Run TanStack AI harnesses in WBX Sandbox Firecracker microVMs with the @wbx-sandbox/tanstack-ai sandbox provider: files, processes, ports, snapshots, and fork."6+keywords:7+tanstack ai8+wbx sandbox9+sandbox provider10+microvm11+firecracker12+harness13+community adapter14+---15+16+Pass `wbxSandbox()` from `@wbx-sandbox/tanstack-ai` to `defineSandbox`. The agent then runs in a [WBX Sandbox](https://sandbox.wbx.cz) Firecracker microVM. The WBX Sandbox team maintains the package.17+18+It is a `SandboxProvider`, the same contract as the bundled [providers](../sandbox/providers). Your workspace, policy, and harness do not change.19+20+## 1. Install21+22+<!-- ::start:tabs variant="package-manager" mode="install" -->23+24+react: @wbx-sandbox/tanstack-ai @tanstack/ai @tanstack/ai-sandbox@@ -0,0 +55,21 @@55+ defineWorkspace,56+ githubRepo,57+ withSandbox,58+} from '@tanstack/ai-sandbox'59+import { wbxSandbox } from '@wbx-sandbox/tanstack-ai'60+61+const repoSandbox = defineSandbox({62+ id: 'bug-fixer',63+ provider: wbxSandbox({ template: 'node' }),64+ workspace: defineWorkspace({65+ source: githubRepo({ repo: 'owner/buggy-app' }),66+ packageManager: 'pnpm',67+ setup: [GROK_CLI_INSTALL_COMMAND, 'corepack enable', 'pnpm install'],68+ secrets: createSecrets({69+ XAI_API_KEY: process.env.XAI_API_KEY ?? '',70+ }),71+ }),72+ lifecycle: { reuse: 'thread', snapshot: 'after-setup', keepAlive: '30m' },73+})74+75+const stream = chat({
github-actions[bot](GitHub profile, opens in a new tab) assignedtombeckenham
github-actions[bot](GitHub profile, opens in a new tab) added labelswaiting-on: maintainer
Pushed264b714
- @@ -0,0 +67,21 @@67+ source: githubRepo({ repo: 'owner/buggy-app' }),68+ packageManager: 'pnpm',69+ setup: [GROK_CLI_INSTALL_COMMAND, 'corepack enable', 'pnpm install'],70+ secrets: createSecrets({71+ XAI_API_KEY: process.env.XAI_API_KEY ?? '',72+ }),73+ }),74+ lifecycle: { reuse: 'thread', snapshot: 'after-setup', keepAlive: '30m' },75+})76+77+const stream = chat({78+ threadId: 'bug-fix-1',79+ adapter: grokBuildText('grok-build'),80+ messages: [81+ { role: 'user', content: 'The tests fail. Find the bug and fix it.' },82+ ],83+ middleware: [withSandbox(repoSandbox)],84+})85+86+for await (const chunk of stream) {87+ if (chunk.type === 'TEXT_MESSAGE_CONTENT') {@@ -0,0 +73,21 @@73+ }),74+ lifecycle: { reuse: 'thread', snapshot: 'after-setup', keepAlive: '30m' },75+})76+77+const stream = chat({78+ threadId: 'bug-fix-1',79+ adapter: grokBuildText('grok-build'),80+ messages: [81+ { role: 'user', content: 'The tests fail. Find the bug and fix it.' },82+ ],83+ middleware: [withSandbox(repoSandbox)],84+})85+86+for await (const chunk of stream) {87+ if (chunk.type === 'TEXT_MESSAGE_CONTENT') {88+ process.stdout.write(chunk.delta)89+ }90+}91+```92+93+The agent starts when you read the stream. It clones the repo, installs the dependencies, and works in its own microVM. If the sandbox of this thread is gone later, the framework restores the snapshot from after setup and skips the install.
Pushedcb6f1e2
AlemTuzlak approved these changes
github-actions[bot](GitHub profile, opens in a new tab) added labelswaiting-on: author
github-actions[bot](GitHub profile, opens in a new tab) removed labelswaiting-on: maintainer
Sign in to join this conversation.
⚠️ No Changeset found#
Latest commit: cb6f1e25d58a3b6589d0adf9fd9377c84f5e6532
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR