Skip to Content
ai-sdk-harness

Introduction

Community packages for the Vercel AI SDK harnesses, for Docker Sandboxes, microsandbox, Cloud Run sandboxes, Anthropic Sandbox Runtime, plugins, sessions and approvals.

The AI SDK harnesses drive a coding-agent runtime (Claude Code, Codex, OpenCode…) from your application, through a HarnessAgent. This project publishes community packages for it, under the fpasquet npm account, of four kinds:

  • Sandboxes: where the agent runs. Every command and file operation of the agent happens there, and the credentials stay outside.
  • Plugins: what the agent can do. Tools, skills, rules, slash commands, hooks, subagents and MCP servers, bundled into plugins that apply to every runtime.
  • Sessions: the conversations of your users with the agent. Several side by side in one sandbox, suspended when idle, resumed on the next message and after a restart.
  • Approvals: a person in the loop. A policy that lets the agent's harmless commands run, refuses what you forbid and asks about the rest, with "always allow" for a conversation.

Sandboxes

A sandbox package gives HarnessAgent.createSession({ sandboxSession }) what it expects, a HarnessV1NetworkSandboxSession: switching from one to the other is a matter of which function creates it.

PackageWhere the agent runsStatus
ai-sdk-sandbox-sbxA Docker Sandbox microVM (sbx), on your machine or in Docker Sandboxes CloudPreview, 0.x (cloud mode experimental)
ai-sdk-sandbox-microsandboxA microsandbox microVM, booted from any OCI image on your machinePreview, 0.x
ai-sdk-sandbox-cloud-runA Cloud Run sandbox on Google Cloud, scaled to zero between turnsPreview, 0.x
ai-sdk-sandbox-gceA Compute Engine virtual machine per sandbox on Google Cloud, Docker includedPreview, 0.x
ai-sdk-sandbox-runtimeAnthropic Sandbox Runtime (srt) on this host: bubblewrap or sandbox-execPreview, 0.x (srt is a research preview)

Plugins

ai-sdk-harness-plugins (Preview, 0.x) works with any sandbox and any runtime. A plugin is written in code with definePlugin(), read from a Claude Code plugin directory with loadClaudeCodePlugin(), or written as JSON: plugins are configuration, wherever they are kept. A catalog gathers them for a marketplace, where each agent picks whole plugins or single tools, skills, rules, commands, hooks, subagents and MCP servers, with what they require; withPlugins() applies what it picked.

A plugin's…What it isClaude CodeCodex
toolsAI SDK tools run on your server, or commands run in the sandbox✅✅
skillsInstructions the agent loads when it judges them relevant✅✅
rulesInstructions the agent follows, for every file or some✅✅
commands/<name> prompts, expanded on your server✅✅
hooksCommands the runtime runs at a moment of the session, in the sandbox✅✅
subagentsSpecialists the agent delegates to✅✅
MCP serversConnected by your server, or run by the runtime in the sandbox✅✅

A hook at work in the Next.js starter: the agent may not read the .env file

A hook at work in the Next.js starter: written in JSON with its script, it runs in the sandbox before each read or shell command of Claude Code. It blocked the reading of .env, and told the agent why.

Sessions

ai-sdk-harness-sessions (Preview, 0.x) runs the sessions of a HarnessAgent for you, whatever the runtime and the sandbox: one turn at a time per session, several sessions side by side in one sandbox (each in a view of it, fork()), a session suspended when nobody writes to it and resumed on the next message, a turn paused until the user approves a command, and every session suspended when your server stops, to be resumed after it starts again.

Two conversations of the Next.js starter working at once in one Docker Sandbox

Workspaces

ai-sdk-harness-workspace (Preview, 0.x) puts your repository in the sandbox: each session works in a checkout of its own, a Git worktree on a branch of its own, so several agents work side by side on one repository, and what each one changed comes back as a patch your server applies. The code comes from a Git server, its token brokered rather than handed to the sandbox, from your server as Git bundles, or from the sandbox itself.

A conversation of the Next.js starter on a repository: the files its agent changed, and the patch

Approvals

ai-sdk-harness-approval (Preview, 0.x) keeps a person in the loop, the same way for every harness: an approval policy allows the agent's commands and edits you trust, refuses those you forbid with a reason the agent reads, and leaves the rest to the user, who can allow them for the rest of the conversation. With ai-sdk-harness-sessions, the policy answers within the turn. Its components, ToolApproval and QuestionsForm, install from this site's shadcn registry.

A command allowed by the policy, one refused, one waiting with "Always allow"

Network

ai-sdk-harness-network (Preview, 0.x) closes the sandbox's network to all but what the agent needs: the hosts of the forges, package registries, toolchains and container registries of the whole ecosystem, those each harness and model provider calls, and those your workspace and plugins name, checked and merged into a network policy every sandbox package takes.

Versioning

Every package is released on its own with Changesets, and is in its 0.x series: its API settles with the feedback of the people trying it, before a 1.0.0. The public API is what a package exports from its entry point. Until 1.0.0, a minor release (0.1 → 0.2) may break it, and its changelog says how with a BREAKING: note; a patch release (0.1.0 → 0.1.1) never does. The caret range npm installs by default, ^0.1.0, therefore stays on 0.1.x. The AI SDK harnesses are themselves experimental: when their HarnessV1 interfaces break, the packages follow in their next minor.

From 1.0.0 on, the packages will follow Semantic Versioning: breaking changes in a major only, except a feature documented as experimental, such as the cloud mode of ai-sdk-sandbox-sbx, which may change in a minor release and says so.

Feedback is what gets the packages to 1.0.0: open an issue for what works, what does not, and what is missing.

On this page