@eigenpal/sdk

中文文档
0.23.15发布于 2026/11/13Apache-2.0TypeScriptES Module近 30 天下载 1.3万

Official TypeScript SDK for the EigenPal API

原始使用文档
文档目录9 节
  1. Install
  2. Quick Start
  3. Automations
  4. Folders
  5. Runs
  6. Files And Artifacts
  7. Errors
  8. Reference
  9. License

@eigenpal/sdk

Trigger and inspect Eigenpal automations from TypeScript.

npm downloads license

Install

npm i @eigenpal/sdk

Requires a TypeScript-aware runtime: Bun, Deno, Node 22+ (native TS), tsx, Next.js, Vite, or any modern bundler. Plain node script.js will not work; see Configuration.

Get an API key at studio.eigenpal.com -> Settings -> API Keys.

Quick Start

import { EigenpalClient } from '@eigenpal/sdk';

const client = new EigenpalClient({ apiKey: process.env.EIGENPAL_API_KEY });

const result = await client.run(
  'workflows.extract-invoice',
  { contract_document: file },
  { waitForCompletion: 60 }
);

if (result.finished) {
  console.log(result.output);
}

target accepts a bare workflow ID such as wf_abc, or a typed target such as workflows.<id-or-slug> or agents.<slug>. Slugs need the prefix because workflow and agent slugs can overlap.

Automations

Workflows and agents are exposed as automations.

const { data } = await client.automations.list({ search: 'invoice', folderId: 'fldr_…' });
const automation = await client.automations.get('workflows.extract-invoice');
await client.automations.move('workflows.extract-invoice', { folderPath: 'billing/invoices' });
await client.automations.delete('workflows.extract-invoice');

list({ folderId: 'null' }) returns unfiled YAML workflows at the tenant root. Agent automations have no folder model.

Workflow delete archives the automations parent and keeps execution history. Agent delete removes the agent implementation and history, matching the dashboard, with best-effort leftover storage cleanup.

Folders

Workflow and template trees are a first-class resource. Nested agent directories in Git are source organization only.

const tree = await client.folders.list({ type: 'workflow', tree: 'true' });
const folder = await client.folders.create({ name: 'invoices', type: 'workflow' });
await client.folders.update(folder.id, { name: 'billing' });
await client.folders.delete(folder.id); // unfiles workflows; does not delete them

Runs

const { id } = await client.run('agents.invoice-agent', { invoice: file });

const run = await client.runs.get(id, { expand: ['usage', 'execution'] });
const usage = await client.runs.usage(id);
const steps = await client.runs.steps(id);
const events = await client.runs.events(id);
const trace = await client.runs.trace.get(id);

await client.runs.cancel(id);
await client.rerun(id, { waitForCompletion: 60 });

List calls use the same run API for workflows, agents, manual runs, and eval runs:

const recentFailures = await client.runs.list({
  type: 'workflow',
  status: 'failed,cancelled',
  limit: 50,
});

Files And Artifacts

Use client.files for reusable upload-first blobs. When referenced by a run input, Eigenpal snapshots the file into run-scoped artifacts.

const uploaded = await client.files.upload(file);

const started = await client.run('workflows.extract-invoice', {
  contract_document: { $fileId: uploaded.id },
});

const artifacts = await client.runs.artifacts.list(started.id);
const pdf = await client.runs.artifacts.download(started.id, artifacts.artifacts[0].path);

You can also pass a File, Blob, or { content, filename, mimeType } directly to client.run; the SDK sends multipart form data automatically. Durable run inputs and dataset examples store scoped { "$file": "input/..." } artifact refs after ingestion.

Errors

Every non-2xx response throws a typed subclass of EigenpalError:

HTTPClass
400EigenpalValidationError
401EigenpalAuthError
403EigenpalForbiddenError
404EigenpalNotFoundError
429EigenpalRateLimitError
5xxEigenpalServerError
timeout / abortEigenpalTimeoutError

Reference

TopicWhat is in it
AutomationsList, inspect, move, delete, versions, triggers, folders.
RunsStart, poll, cancel, rerun, usage, steps, events, traces, reviews.
File inputsMultipart upload from File, Blob, Buffer, or path.
ErrorsTyped exceptions, retries, request ids.
ConfigurationAPI key, baseUrl, timeouts, headers.
Full API referenceEvery method, generated from OpenAPI.

License

Apache-2.0.

版本与发布记录

@eigenpal/sdk 共发布 263 个版本,首次发布于 2026/05/08;过去 12 个月发布了 263 个版本。

版本发布日期距今
0.23.15latest2026/11/13今天
0.23.142026/11/13今天
0.23.132026/11/13今天
0.23.122026/11/121 天前
0.23.112026/11/121 天前
0.23.92026/11/112 天前

其他发布通道:bootstrap → 0.0.0-placeholder。

关于 @eigenpal/sdk 的常见问题

@eigenpal/sdk 是什么?

Official TypeScript SDK for the EigenPal API

如何安装 @eigenpal/sdk?

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

@eigenpal/sdk 支持 TypeScript 吗?

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

@eigenpal/sdk 支持 ESM 还是 CommonJS?

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

@eigenpal/sdk 可以商用吗?

@eigenpal/sdk 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@eigenpal/sdk 的下载量有多少?

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

@eigenpal/sdk 还在维护吗?

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