npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@groundbox/ai-sdk

v0.1.1

Published

Groundbox sandboxes for the Vercel AI SDK: a Firecracker microVM Linux sandbox for your agent's tools and for harness agents like Claude Code and Codex.

Readme

@groundbox/ai-sdk

Groundbox sandboxes for the Vercel AI SDK. Each sandbox is a Firecracker microVM with its own kernel and cores: Ubuntu 24.04 with git, Node, Python and Docker, and user runner with passwordless sudo. It implements the AI SDK's sandbox interface, the same one @ai-sdk/sandbox-vercel and @e2b/ai-sdk-sandbox implement, so you can:

  • hand it to your own tools with experimental_sandbox in generateText, streamText or a ToolLoopAgent, and
  • run harness agents such as Claude Code and Codex (HarnessAgent) inside it.

Install

npm install @groundbox/ai-sdk ai

Node 22.13 or newer. Set GROUNDBOX_API_KEY (create a key at app.groundbox.dev/keys), or pass apiKey.

Give your tools a sandbox

import { anthropic } from '@ai-sdk/anthropic';
import { createGroundboxNetworkSandboxSession } from '@groundbox/ai-sdk';
import { generateText, isStepCount, tool } from 'ai';
import { z } from 'zod';

const sandbox = await createGroundboxNetworkSandboxSession({ spec: { cpus: 2 } });

const bash = tool({
  description: 'Run a shell command in a Linux sandbox',
  inputSchema: z.object({ command: z.string() }),
  execute: ({ command }, { experimental_sandbox }) => experimental_sandbox!.run({ command }),
});

try {
  const result = await generateText({
    model: anthropic('claude-sonnet-5-5'),
    tools: { bash },
    stopWhen: isStepCount(10),
    prompt: 'Write a Python script that prints the first 20 primes, then run it.',
    // The restricted view: files and commands, no way to stop the VM or change its network.
    experimental_sandbox: sandbox.restricted(),
  });
  console.log(result.text);
} finally {
  await sandbox.destroy(); // deletes the VM; billing stops
}

The session on its own:

const session = sandbox.restricted();
await session.writeTextFile({ path: 'hello.py', content: 'print("hi")' });
const { stdout } = await session.run({ command: 'python3 hello.py' }); // "hi\n"

Run Claude Code (or Codex) in it

import { HarnessAgent } from '@ai-sdk/harness/agent';
import { createClaudeCode } from '@ai-sdk/harness-claude-code';
import { createGroundboxNetworkSandboxSession } from '@groundbox/ai-sdk';

const agent = new HarnessAgent({ harness: createClaudeCode(), id: 'coder' });

const sandboxSession = await createGroundboxNetworkSandboxSession({
  spec: { cpus: 2, memory_gb: 4 },
  ports: [4000],
  template: await agent.getSandboxTemplate(),
});
const session = await agent.createSession({ sandboxSession });

try {
  const result = await agent.generate({ session, prompt: 'Read README.md and summarise the goals.' });
  console.log(result.text);
} finally {
  await session.destroy();
  await sandboxSession.destroy();
}

The first run with a template installs the harness in a fresh sandbox and keeps it as a Groundbox snapshot (labelled ai-sdk-harness-v1-...). Later runs with the same template and machine start from that snapshot instead of installing again.

What maps to what

| AI SDK | Groundbox | | --- | --- | | createGroundboxNetworkSandboxSession() | Creates a sandbox from spec (anything create_sandbox takes: template, image, cpus, memory_gb, timeout_minutes, allow_hosts, env, metadata, ...) and waits until it runs. | | sandboxId option | Kept in the sandbox's metadata (ai-sdk-sandbox-id), so you can resume by your own id. A second live sandbox with the same id is refused. | | template option | Built once into a kept snapshot; later sessions start from it. | | resumeGroundboxNetworkSandboxSession({ sandboxId }) | Finds the sandbox by your id or its sbx_... id. Resumes a paused one and boots a shut-down one; never creates one. | | run / spawn | The exec stream. Commands run under bash -c (or sh -c) in the working directory, for up to a day; spawn with stdin: true keeps stdin open. Abort signals kill the command. | | files | Groundbox's files API: read, write, stat (follows symlinks), list, delete. | | ports, getPortEndpoint, setPorts | Preview URLs, https://...groundbox.page. Private by default: getPortEndpoint returns the token header to send. publicPorts: true makes them public. Servers must listen on 0.0.0.0. | | setNetworkPolicy | The sandbox's egress rules: allow-all, deny-all, or hosts (with *. wildcards) and IPv4 networks. IPv6 networks are refused. | | stop() | Shuts the VM down and keeps its disk (only storage is billed). resume... boots it again. | | destroy() | Deletes the VM. | | restricted() | The plain sandbox session for tools: files, run and spawn only. |

Already have a sandbox? createGroundboxSandboxSession({ sandboxId }) wraps it as a plain session for experimental_sandbox, and createGroundboxNetworkSandboxSessionFromSandbox({ sandboxId }) as a network session for a harness. Pass your own @groundbox/sdk client as client for anything this package does not wrap (fork, save points, secrets bound to hosts).

Tests

npm test                                   # unit tests, no network
GROUNDBOX_API_KEY=gbx_... npm run test:live # real sandboxes, deleted afterwards

The Claude Code live test sends a prompt only when ANTHROPIC_API_KEY is set too.

License

MIT