项目 /

项目概览

Agent Runtime

为任务执行、工具调用、状态与生命周期事件提供开源原语。

用途与设计边界

源码把一次任务执行器连接到显式的运行上下文。注册具名工具后,执行器通过上下文访问任务数据、状态及取消信号。状态持久化和运维策略由宿主及其适配器决定。

上手与兼容性

项目仍在开发中。可检出固定提交,安装开发依赖,并在仓库根目录运行 npm run build。ESM 构建要求 Node.js ^20.19.0 || >=22.12.0,产物入口是 dist/index.js。下例是放在根目录的 .mjs 文件,用来说明如何通过具名工具执行任务。 固定源码入口 · 固定构建清单

import { createRuntime, defineTool } from './dist/index.js';
const runtime = createRuntime({ tools: [defineTool({
  name: 'label', execute: input => String(input).trim()
})] });
const result = await runtime.run({ type: 'example', input: ' note ' },
  (context, task) => context.callTool('label', task.input));
console.log(result.output);

项目关系