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

@cuylabs/agent-sandbox-docker

v4.6.0

Published

Docker-backed sandbox sessions and execution hosts for @cuylabs/agent-core

Readme

@cuylabs/agent-sandbox-docker

Docker-backed sandbox sessions and execution hosts for @cuylabs/agent-core.

Use this package when you want host-aware tools to run inside Docker instead of on the local machine. The package supports:

  • low-level ToolHost adaptation for an existing container via dockerHost()
  • higher-level DockerSandboxSession lifecycle for a managed Docker environment with snapshot(), extendTimeout(), and getPreviewUrl() support
  • registerDockerHostProvider() for registry-based host discovery

The agent loop, model calls, middleware, and sessions still live in your Node.js process. Only host-backed tool operations are redirected into the container through the ToolHost interface from @cuylabs/agent-core/tool/host.

Package Boundary

@cuylabs/agent-core owns:

  • the ToolHost interface
  • the SandboxSession interface
  • the default localHost()
  • the ToolHostRegistry and defaultToolHostRegistry
  • the executor path that passes ctx.host into tools

@cuylabs/agent-sandbox-docker owns:

  • connecting ToolHost to a running Docker container
  • path resolution inside the container
  • file and shell operations implemented through Docker exec sessions (with stdin piping for large files)
  • DockerSandboxSession class implementing the full SandboxSession contract
  • container snapshot via commit(), lease/timeout tracking, and preview URL construction
  • optional self-registration into ToolHostRegistry via registerDockerHostProvider()

That same pattern is intended for other host packages too. Docker is one concrete backend implementing the public ToolHost contract from agent-core.

Quick Start

Managed Session (recommended)

import { createAgent } from "@cuylabs/agent-core";
import { createDockerSandboxSession } from "@cuylabs/agent-sandbox-docker";

const sandbox = await createDockerSandboxSession({
  create: {
    image: "node:20",
    workdir: "/workspace",
  },
  timeoutMs: 300_000,     // 5 minute lease
  hostAddress: "localhost", // for preview URLs
});

const agent = createAgent({
  model,
  sandbox,
});

// Snapshot the environment
const snap = await sandbox.snapshot();

// Extend the lease
await sandbox.extendTimeout(60_000);

// Get preview URL for an exposed port
const url = sandbox.getPreviewUrl(3000); // "http://localhost:3000"

// Clean up
await sandbox.stop();

Attach to Existing Container

import { createDockerSandboxSession } from "@cuylabs/agent-sandbox-docker";

const sandbox = await createDockerSandboxSession({
  container: "my-workspace",
  workdir: "/workspace",
});

Low-Level Host Only

If you already manage the container lifecycle yourself:

import { dockerHost } from "@cuylabs/agent-sandbox-docker";

const host = await dockerHost({
  container: "my-sandbox",
  workdir: "/workspace",
});

Registry Integration

import { registerDockerHostProvider } from "@cuylabs/agent-sandbox-docker";
import { defaultToolHostRegistry } from "@cuylabs/agent-core/tool/host";

// Call once at startup
registerDockerHostProvider();

// Then create hosts by name
const host = await defaultToolHostRegistry.create("docker", {
  container: "my-workspace",
});

Start Here

agent-core keeps the host contract and the default local host. Concrete non-local hosts live in separate packages so they can evolve independently.