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

@sandagent/manager

v0.2.10

Published

SandAgent Manager - Manages sandbox and runner lifecycle, defines core interfaces

Readme

@sandagent/manager

Core manager package for SandAgent - manages sandbox and runner lifecycle, defines core interfaces.

This package is the core runtime that wires sandbox adapters + a runner spec into an AI SDK UI stream you can consume from your server or CLI.

Overview

@sandagent/manager is the foundational package that provides:

  • SandAgent: Main class for managing sandboxed agent instances
  • Core Interfaces: SandboxAdapter, SandboxHandle, RunnerSpec, etc.
  • Transcript Writers: Tools for logging agent execution (JSONL, Memory, Console, Multi)
  • Type Definitions: Shared types for messages, streams, and sandbox operations

This package is typically used as a dependency by higher-level packages like @sandagent/sdk and sandbox adapters.

Installation

npm install @sandagent/manager

Quickstart

Basic Usage

import { SandAgent } from '@sandagent/manager';
import { E2BSandbox } from '@sandagent/sandbox-e2b';

const agent = new SandAgent({
  sandbox: new E2BSandbox({ apiKey: 'xxx' }),
  runner: {
    kind: 'claude-agent-sdk',
    model: 'claude-sonnet-4-20250514',
    outputFormat: 'stream',
  },
  env: {
    ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY!,
  },
});

// Stream a task
const stream = await agent.stream({
  messages: [
    { role: 'user', content: 'Create a hello world program' }
  ],
  workspace: {
    path: '/workspace',
  },
});

// Read the stream
const reader = stream.getReader();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  process.stdout.write(value);
}

// Cleanup
await agent.destroy();

With Transcript Logging

import { SandAgent, JsonlTranscriptWriter } from '@sandagent/manager';

const transcriptWriter = new JsonlTranscriptWriter('./transcript.jsonl');

const stream = await agent.stream({
  messages: [{ role: 'user', content: 'Do something' }],
  workspace: { path: '/workspace' },
  transcriptWriter,
});

Upload Files

await agent.uploadFiles([
  { path: 'hello.txt', content: 'Hello World!' },
  { path: 'data.json', content: JSON.stringify({ key: 'value' }) },
], '/workspace');

Core Interfaces

SandboxAdapter

Interface that sandbox implementations must follow:

interface SandboxAdapter {
  attach(): Promise<SandboxHandle>;
  getHandle(): SandboxHandle | null;
  getEnv?(): Record<string, string>;
  getWorkdir?(): string;
}

SandboxHandle

Interface for interacting with an attached sandbox:

interface SandboxHandle {
  exec(command: string[], opts?: ExecOptions): AsyncIterable<Uint8Array>;
  upload(files: Array<{ path: string; content: Uint8Array | string }>, targetDir: string): Promise<void>;
  readFile?(filePath: string): Promise<string>;
  runCommand?(command: string): Promise<{ stdout: string; stderr: string; exitCode: number }>;
  destroy(): Promise<void>;
  getWorkdir?(): string;
}

RunnerSpec

Specification for the runner to execute inside the sandbox:

interface RunnerSpec {
  kind: 'claude-agent-sdk' | string;
  model: string;
  systemPrompt?: string;
  maxTurns?: number;
  allowedTools?: string[];
  outputFormat?: 'stream' | 'json';
}

Transcript Writers

Available transcript writers:

  • JsonlTranscriptWriter: Write to JSONL file
  • MemoryTranscriptWriter: Store in memory
  • ConsoleTranscriptWriter: Log to console
  • MultiTranscriptWriter: Write to multiple writers
import { 
  JsonlTranscriptWriter,
  MemoryTranscriptWriter,
  MultiTranscriptWriter 
} from '@sandagent/manager';

const transcriptWriter = new MultiTranscriptWriter([
  new JsonlTranscriptWriter('./transcript.jsonl'),
  new ConsoleTranscriptWriter(),
]);

API Reference

SandAgent

Constructor

new SandAgent(options: SandAgentOptions)

Options:

  • sandbox (required): A SandboxAdapter instance
  • runner (required): RunnerSpec configuration
  • env: Environment variables for the sandbox

Methods

stream(input: StreamInput): Promise<ReadableStream>

Stream a task through the agent. Returns a ReadableStream of AI SDK UI messages.

uploadFiles(files: Array<{ path: string; content: Uint8Array | string }>, targetDir?: string): Promise

Upload files to the agent's workspace.

destroy(): Promise

Destroy the sandbox and release resources.

Requirements

  • Node.js 20+
  • A sandbox adapter (@sandagent/sandbox-e2b, @sandagent/sandbox-local, etc.)

License

Apache-2.0