@agent-assistant/telemetry

中文文档
0.4.37发布于 2026/10/04TypeScriptES Module构建来源已验证近 30 天下载 1.4万

Usage, cost, and response telemetry primitives for Agent Assistant

原始使用文档
文档目录3 节
  1. Human Eval Helpers
  2. Provider-Backed Runs
  3. Agent Relay For Complex Evals

Agent Assistant Telemetry

Human Eval Helpers

@agent-assistant/telemetry/evals includes reusable helpers for product eval systems that keep cases human-authored while sharing deterministic checks and run artifacts.

Products can usually keep only a small wrapper script plus their own evals/suites/*/cases.md files. The shared package provides:

  • Markdown cases.md parsing and compilation to generated cases.jsonl.
  • JSONL suite loading and filtering by suite, case, or tag.
  • Deterministic checks for content, regexes, tool calls, routing metadata, stop reasons, and question counts.
  • Human-review tracking via Must, Must Not, and Human Review: true.
  • Run artifact writing: result.json, summary.md, and human-review.md.
  • A generic CLI run loop with pluggable product executors.
  • Provider executor helpers for local OpenCode one-shot runs and deeper Agent Relay handoffs.
  • CI summary rendering that fails on failed/skipped cases while listing needs-human cases for review.

Minimal product runner:

import {
  compileHumanEvalSuitesFromMarkdown,
  runHumanEvalCli,
  summarizeLatestHumanEvalRunForCi,
} from '@agent-assistant/telemetry/evals';
import path from 'node:path';

const rootDir = path.resolve(import.meta.dirname, '../..');

compileHumanEvalSuitesFromMarkdown({
  suitesDir: path.join(rootDir, 'evals', 'suites'),
});

const exitCode = await runHumanEvalCli({
  argv: process.argv.slice(2),
  rootDir,
  runsDir: path.join(rootDir, '.nightcto', 'evals', 'runs'),
  productName: 'NightCTO Evals',
  executors: {
    async nightcto(testCase, context) {
      // Invoke the product here and normalize to:
      // { content: string, toolCalls: Array<{ name: string }>, status?: string }
      return { content: String(testCase.input.message ?? ''), toolCalls: [] };
    },
  },
});

if (process.env.GITHUB_STEP_SUMMARY) {
  summarizeLatestHumanEvalRunForCi({
    rootDir,
    runsDir: path.join(rootDir, '.nightcto', 'evals', 'runs'),
    githubStepSummaryPath: process.env.GITHUB_STEP_SUMMARY,
    title: 'NightCTO Eval CI Summary',
  });
}

process.exit(exitCode);

Provider-Backed Runs

Provider-backed runs are opt-in so offline deterministic checks stay cheap. Use --provider to allow an executor to call a model or broker, and --executor to run existing manual cases through a provider without rewriting every case.

node scripts/evals/run-product-evals.mjs --provider --executor opencode --suite workflow-authoring

The OpenCode helper wraps the Agent Assistant harness CLI runner, so products can use free or local OpenCode models without OpenRouter credentials:

import {
  createOpenCodeHumanEvalExecutor,
  runHumanEvalCli,
} from '@agent-assistant/telemetry/evals';

const exitCode = await runHumanEvalCli({
  argv: process.argv.slice(2),
  rootDir,
  productName: 'Ricky Evals',
  executors: {
    opencode: createOpenCodeHumanEvalExecutor({
      productName: 'Ricky',
      model: 'opencode/minimax-m2.5-free',
      instructions: [
        'Follow Ricky workflow standards.',
        'Prefer deterministic verification, review artifacts, and honest blocker reporting.',
      ],
    }),
  },
});

Use the direct OpenCode path for quick local quality sweeps where the candidate answer is a single assistant response. The result is still usually needs-human; the model output is captured into human-review.md for a person to grade against the case's Must and Must Not bullets.

Agent Relay For Complex Evals

Use Agent Relay when the eval needs real execution topology rather than a single model answer: worker spawning, tool-mediated work, channel/broker behavior, multi-agent coordination, or a product path that depends on Relay metadata. createAgentRelayHumanEvalExecutor() dynamically imports the Node-only Relay adapter only when this executor runs.

import {
  createAgentRelayHumanEvalExecutor,
  runHumanEvalCli,
} from '@agent-assistant/telemetry/evals';

const exitCode = await runHumanEvalCli({
  argv: process.argv.slice(2),
  rootDir,
  productName: 'Ricky Evals',
  executors: {
    relay: createAgentRelayHumanEvalExecutor({
      productName: 'Ricky',
      channelId: 'agent-assistant-evals',
      workerName: 'ricky-eval-worker',
      timeoutMs: 300_000,
      spawnWorker: {
        enabled: true,
        cli: 'opencode',
        model: 'opencode/minimax-m2.5-free',
        includeWorkflowConventions: true,
      },
      instructions: 'Exercise the real worker path and return an Agent Assistant ExecutionResult.',
    }),
  },
});

Run those cases with:

node scripts/evals/run-product-evals.mjs --provider --executor relay --case workflow-authoring.multi-agent-repair

For long-running evals, prefer one case or one suite at a time and give the executor a larger timeout. Relay eval outputs include normalized content, structured tool calls when present, Relay metadata, and trace data in the normal human-eval run artifacts.

版本与发布记录

@agent-assistant/telemetry 共发布 53 个版本,首次发布于 2026/04/20;过去 12 个月发布了 53 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.37latest2026/10/041 个月前
0.4.362026/10/041 个月前
0.4.352026/05/235 个月前
0.4.332026/05/155 个月前
0.4.322026/05/125 个月前
0.4.312026/05/086 个月前

关于 @agent-assistant/telemetry 的常见问题

@agent-assistant/telemetry 是什么?

Usage, cost, and response telemetry primitives for Agent Assistant

如何安装 @agent-assistant/telemetry?

在项目目录运行 npm install @agent-assistant/telemetry,或使用 pnpm add / yarn add / bun add。

@agent-assistant/telemetry 支持 TypeScript 吗?

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

@agent-assistant/telemetry 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agent-assistant/telemetry 可以商用吗?

@agent-assistant/telemetry 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@agent-assistant/telemetry 的下载量有多少?

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

@agent-assistant/telemetry 还在维护吗?

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