@coder/ai-sdk-sandbox has 176 recorded weekly downloads on npm, a decrease of 86.5% over the past 30 days, ranking #2525 of 3,247 tracked listings.
About @coder/ai-sdk-sandbox
@coder/ai-sdk-sandbox
Run CLI coding agents from the Vercel AI SDK v7 HarnessAgent inside a real Coder workspace instead of an ephemeral cloud sandbox.
- Implements the
HarnessV1SandboxProvidercontract from@ai-sdk/harness: pass it as thesandboxto aHarnessAgent, exactly like@ai-sdk/sandbox-vercel. - Claude Code is verified end-to-end. Codex is expected to work via the same bridge mechanism but is not yet verified in this repo.
Status: experimental. Tracks the stable AI SDK v7 harness packages (see the
@ai-sdk/harnesspeer range inpackage.json).
Install
pnpm add @coder/ai-sdk-sandbox @ai-sdk/harness @ai-sdk/harness-claude-code @ai-sdk/provider-utils
Choose one host transport:
| Transport | Host requirements |
|---|---|
CoderCliTransport (default) | coder CLI, an authenticated coder login, and an OpenSSH client (ssh) on PATH |
CoderNativeTransport | A deployment URL and token. No coder or ssh binary. See Native transport |
Quick start
Wrap an existing, running workspace and run Claude Code in it:
import { HarnessAgent } from "@ai-sdk/harness/agent";
import { createClaudeCode } from "@ai-sdk/harness-claude-code";
import { createCoderWorkspace } from "@coder/ai-sdk-sandbox";
const agent = new HarnessAgent({
harness: createClaudeCode({ thinking: { type: "adaptive" } }),
sandbox: createCoderWorkspace({ workspace: "my-dev-workspace" }),
instructions: "You are a careful coding assistant.",
});
const session = await agent.createSession();
try {
const result = await agent.generate({
session,
prompt: "Create a short TODO.md in the repo root.",
});
console.log(result.text);
} finally {
await session.destroy();
}
Runnable version: examples/claude-code.ts.
Native transport
Use CoderNativeTransport when the host should not depend on the Coder CLI or
OpenSSH:
import { CoderNativeTransport, createCoderWorkspace } from "@coder/ai-sdk-sandbox";
const transport = new CoderNativeTransport({
url: process.env.CODER_URL!,
token: process.env.CODER_SESSION_TOKEN!,
});
const sandbox = createCoderWorkspace({
workspace: "my-dev-workspace",
transport,
});
// On application shutdown, close cached relay WebSockets:
await transport.close();
- The constructor falls back to
CODER_URLandCODER_SESSION_TOKEN, sonew CoderNativeTransport()is enough when both are set. - The token is sent only to Coderd in the
Coder-Session-Tokenheader. It is never copied into the workspace.
Creating workspaces on demand
Add a create block to create a workspace from a template (with parameters
and/or a preset) and tear it down when the session ends:
const agent = new HarnessAgent({
harness: createClaudeCode({ thinking: { type: "adaptive" } }),
sandbox: createCoderWorkspace({
create: {
template: "docker", // required: the template to create from
preset: "Large", // optional: a template version preset
parameters: { cpus: 8, region: "us-west-2" },
useParameterDefaults: true, // accept template defaults for the rest
stopAfter: "8h", // auto-stop TTL
},
}),
});
By default this is fresh-per-session:
- The workspace name is derived from the harness
sessionId(e.g.agent-1a2b3c4d5e6f), so each session gets its own workspace. session.destroy()deletes it.resumeSessionre-derives the same name and reattaches.- The harness runs only after the workspace agent finishes connecting and
running its startup script (
lifecycle_state: ready). A successful build is not enough on its own.
To get-or-create a named workspace, combine workspace with create. If
it exists, the provider attaches to it (and never deletes it). If it doesn't,
the provider creates it (and, by default, owns it).
createCoderWorkspace({
workspace: "my-agent-ws",
create: { template: "docker", ifExists: "attach" }, // 'attach' (default) | 'error'
});
Parameters vs. presets:
- A preset's parameter values take precedence over an overlapping
parametersentry of the same name (Coder's behavior). Set a given value via the preset orparameters, not both. - Every unset non-ephemeral parameter must be supplied via
parameters,parameterFile, or apreset, unlessuseParameterDefaultsaccepts its template default. - Parameters marked required have no usable default and must always be supplied; otherwise creation fails because it cannot prompt non-interactively.
- If you set a
preset, the provider preflight-validates the name against the template's presets and fails fast with the available names. Setvalidate: falseto skip.
Create settings…
Description from the npm listing.
- ai-sdk
- claude-code
- coder
- codex
- harness
- sandbox
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm AI SDKs plugins
All 20 @coder/ai-sdk-sandbox alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@coder/ai-sdk-sandbox. First seen Oct 16, 2026; last successful collection Dec 3, 2026. See the methodology.