@computesdk/agent37

中文文档
0.1.7发布于 2026/11/13MITTypeScriptESM + CJS近 30 天下载 2038

Agent37 provider for ComputeSDK - Linux sandboxes and dedicated-core VMs for AI agents, with public URLs for any port

原始使用文档
文档目录8 节
  1. Installation
  2. Setup
  3. Quick Start
  4. Configuration
  5. Create Options
  6. Features
  7. Limitations
  8. Links

@computesdk/agent37

Agent37 provider for ComputeSDK - persistent Linux sandboxes for AI agents, with signed URLs for any port and an optional Performance type whose cores are held for it.

Installation

npm install @computesdk/agent37

Setup

  1. Create an API key at agent37.com/dashboard/cloud/api-keys
  2. Set the environment variable:
export AGENT37_API_KEY=sk_live_your_api_key

Quick Start

import { compute } from 'computesdk';
import { agent37 } from '@computesdk/agent37';

compute.setConfig({
  provider: agent37({ apiKey: process.env.AGENT37_API_KEY }),
});

const sandbox = await compute.instances.create();

const result = await sandbox.runCommand('node -v && python3 --version');
console.log(result.stdout);

await sandbox.destroy();

Or call the provider factory directly:

import { agent37 } from '@computesdk/agent37';

const sdk = agent37({ apiKey: process.env.AGENT37_API_KEY });
const sandbox = await sdk.sandbox.create({ type: 'performance', cpu: 4, memory: 16384 });

Configuration

interface Agent37Config {
  /** Agent37 API key - if not provided, will use AGENT37_API_KEY env var */
  apiKey?: string;
  /** API base URL - defaults to AGENT37_BASE_URL, then https://api.agent37.com */
  baseUrl?: string;
  /** Exec base URL - defaults to AGENT37_EXEC_URL, then https://sandbox.agent37.app */
  execUrl?: string;
  /** Run commands as root (default true). Set false to run as the image's own user. */
  runAsRoot?: boolean;
}

Create Options

OptionMaps toNotes
templateIdtemplateTemplate name. Default agent37-base (Debian with Node, Python, git and build tools).
typetypedefault, performance (a whole machine whose cores are held for it) or vm.
cpu (or vcpus, cpus)resources.cpuvCPUs. Sizes are 2 vCPU / 4 GB, 4 / 8, 4 / 16 and 4 / 32.
memory (MB, or memoryMiB, memoryMb)resources.memoryRounded up to whole GB.
sizeClassresourcesStandard sizes: md (2 vCPU / 4 GB) and lg (4 / 8). xs, sm, xl and 2xl fail with unsupported; combining sizeClass with cpu/memory is a conflict.
diskMb (or diskMiB)resources.diskRounded up to whole GB.
regionregionus (default), eu or ap-south.
envsenvEnvironment variables for the sandbox.
name, metadataname, metadataLabels returned on the instance.

Features

  • Command execution with cwd, env and background commands
  • Filesystem read, write, list, mkdir, exists and remove
  • Port URLs: getUrl({ port }) returns a signed URL that reaches the port without an API key for one hour
  • Persistence: a sandbox keeps its files and installed packages until you destroy it

Limitations

  • Output is returned when the command finishes; there is no streaming.
  • runCommand's timeout stops waiting for the result. The command itself keeps running in the sandbox.
  • Filesystem content is UTF-8 text, not arbitrary binary. Writes use bounded exec requests and a unique mode-0600 staging file in the remote shell's writable TMPDIR (default /tmp), then overwrite in place. Staging does not require destination-directory write permission. Existing permissions and hard links are preserved, and symlinks are followed. When flock is available (as in the base template), an inode lock prevents concurrent SDK writes to the same inode from interleaving; lock errors are propagated. Custom images without flock fall back to ordinary redirection, so concurrent writes to the same inode can interleave. Readers can observe the final copy in progress in either case. Failed uploads leave the destination unchanged; a failure during final publication can leave an empty or partial file.
  • Reads use GNU stat, dd and base64 to transfer at most 256 KiB per exec, below the 512 KB output cap, then decode UTF-8 across chunk boundaries. Empty files and symlink targets are supported. Truncation, malformed chunks, read errors, short reads and detected file changes throw instead of returning partial content. Reads are not snapshots: avoid modifying the file during a transfer. The complete string is still held in client memory.
  • Sandboxes have no lifetime limit, so always call destroy() when you are done.

版本与发布记录

@computesdk/agent37 共发布 8 个版本,首次发布于 2026/11/04;过去 12 个月发布了 8 个版本。

版本发布日期距今
0.1.7latest2026/11/13今天
0.1.62026/11/113 天前
0.1.52026/11/077 天前
0.1.42026/11/077 天前
0.1.32026/11/077 天前
0.1.22026/11/068 天前

关于 @computesdk/agent37 的常见问题

@computesdk/agent37 是什么?

Agent37 provider for ComputeSDK - Linux sandboxes and dedicated-core VMs for AI agents, with public URLs for any port

如何安装 @computesdk/agent37?

在项目目录运行 npm install @computesdk/agent37,或使用 pnpm add / yarn add / bun add。

@computesdk/agent37 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@computesdk/agent37 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@computesdk/agent37 可以商用吗?

@computesdk/agent37 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@computesdk/agent37 的下载量有多少?

根据 npm 官方下载统计,@computesdk/agent37 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,038 次,日均约 68 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@computesdk/agent37 还在维护吗?

最新版本 0.1.7 发布于 2026/11/13(今天);至今共发布 8 个版本,其中过去 12 个月发布了 8 个;首次发布于 2026/11/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。