# @camelai/run 中文文档

规范地址：https://npmcn.com/package/%40camelai/run/

版本：0\.22\.1
npm 元数据更新时间：2026-10-19T20:27:22.398Z
中文译文更新时间：2026-11-09T00:20:59.183Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40camelai/run
原文对照：https://npmcn.com/package/%40camelai/run/?lang=original
项目主页：https://run.camelai.com/
源码仓库：https://github.com/qaml-ai/run

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：618 kB，35 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=22
- 运行依赖：1 个
- peer 依赖：@modelcontextprotocol/sdk ^1\.30\.1
- 首次发布：2026-09-30T18:19:54.302Z
- 最新版本发布：2026-10-19T20:27:22.182Z
- 近 30 天下载量：2423（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：17（近 12 个月 17 个）

## 中文简介

骆驼跑道的SDK:在您的应用程序中定义工具,运行时间运行模型循环,历史和沙盒.

## 安装

```sh
npm install @camelai/run
```

也可以使用：`pnpm add @camelai/run`、`yarn add @camelai/run`、`bun add @camelai/run`

## README

# @ camelai/ 运行

CamalRun 的 SDK 类型: 耐用剂, 您使用 键并运行,带有代码中普通函数的工具。 运行时间 运行模型循环,保存每个代理商的历史和文件,并运行 模型写作的代码在一个沙盒中,只能调用工具.

```sh
npm install @camelai/run
```

节点22或后起 Bun, Deno或Cloudflare工人. 创建 API 密钥 [https://run.camelai.com/console/tokens 页面存档备份,存于互联网档案馆](https://run.camelai.com/console/tokens) 并导出为 `CAMELAI_API_KEY`。 。 。 .

编码代理商: 此版本的文档在软件包中, at `node_modules/@camelai/run/docs/SKILL.md` 财务报告和审定财务报表 `docs/sdk.md`设置骆驼跑步 在项目中,改为 [https://run.camelai.com/SKILL.md (英语)](https://run.camelai.com/SKILL.md)。 。 。 .

```ts
import { Agents, schema, tool } from "@camelai/run";

const agents = new Agents();

const weather = tool({
  description: "Today's weather in a city",
  input: schema.Object({ city: schema.String() }),
  execute: ({ city }) => ({ city, forecast: "sunny", highC: 24 }), // runs here, in your process
});

const agent = await agents.upsert("quickstart", {
  instructions: "You are a concise assistant.",
  tools: { weather },
});

const run = await agent.run("Should I bring an umbrella in Lisbon today?");
console.log(run.text);

await agents.close();
```

-   **密钥特工.** `upsert(key, config)` 或带来 现有一个改为 `config`;其历史和文件持续到您删除为止.
-   **运行.** `run()` 解决 `{ status, text, inputs, error, toolErrors, toolCalls, … }` 掷出 `RunError` 失败(除非 `throwOnError: false`) (中文(简体) ). 无超时: 通过 a 一个 `AbortSignal` 别等了. `stream()` 输出文本、工具调用和结果 他们发生,然后逃跑.
-   **环中之人.** 一个工具与 `needsApproval: true` 等待批准; `run.inputs[0].answer(true, { from })` 恢复运行 .
-   **工具 来.** 每个电话 `context.idempotencyKey` 整个复试过程稳定; `timeoutMs` 财务报告和审定财务报表 `context.progress()` 处理长电话。 一次一个过程 为代理工具服务; 无服务器和多用户后端服务 HTTP 为 `serveTools` (单位:千美元)`@camelai/run/server`) (中文(简体) ).
-   **浏览器.** 在您的应用程序中聊天:一条路由 `createAgentHandler` (单位:千美元)`@camelai/run/server`和 `<AgentChat>` 或钩从 `@camelai/run-react` (或 `/chat` 没有反应, `/ai-sdk` 与大赦国际 SDK的车 `useChat`; 见前端指南 (`docs/frontend.md`),或从 `npm create @camelai/run-app`。 。 。 . `watchAgent` (单位:千美元)`@camelai/run/watch`(中文(简体) ) 显示使用浏览器符号运行的代理服务器薄荷.

联合国 [快速启动](https://run.camelai.com/docs/quickstart.md), (中文(简体) ), [概念](https://run.camelai.com/docs/concepts.md), (中文(简体) ), [SDK 参考](https://run.camelai.com/docs/reference/sdk.md), (中文(简体) ), 和所有它作为Markdown在 [https://run.camelai.com/llms.txt (英语)](https://run.camelai.com/llms.txt)。 。 。 .

`AgentRuntime` 财务报告和审定财务报表 `AgentClient`,SDK的下层界面建立在, 继续提供。 请参看SDK参考文献"0.9中的变化"升级时.

## 常见问题

### @camelai/run 是什么？

骆驼跑道的SDK:在您的应用程序中定义工具,运行时间运行模型循环,历史和沙盒\.

### 如何安装 @camelai/run？

在项目目录运行 npm install @camelai/run，或使用 pnpm add / yarn add / bun add。

### @camelai/run 支持 TypeScript 吗？

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

### @camelai/run 支持 ESM 还是 CommonJS？

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

### @camelai/run 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=22。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @camelai/run 可以商用吗？

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

### @camelai/run 的下载量有多少？

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

### @camelai/run 还在维护吗？

最新版本 0\.22\.1 发布于 2026/10/20（20 天前）；至今共发布 17 个版本，其中过去 12 个月发布了 17 个；首次发布于 2026/10/01。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

