@agentskit/runtime

中文文档
0.11.3发布于 2026/10/24MITTypeScriptESM + CJS构建来源已验证近 30 天下载 8711

Standalone agent runtime with ReAct loop for AgentsKit.

原始使用文档
文档目录15 节
  1. Verified proof
  2. How this fits the ecosystem
  3. Why runtime
  4. Install
  5. Quick example
  6. With skills
  7. Features
  8. Advanced primitives
  9. Topology cancellation
  10. Ecosystem
  11. Contributors
  12. License
  13. Docs
  14. Maturity and compatibility
  15. Contributing

@agentskit/runtime

Profile: major-package

AgentsKit

Run autonomous agents in 5 lines — no UI, no boilerplate, just results.

npm version npm downloads bundle size license stability GitHub stars

Tags: ai · agents · llm · agentskit · openai · anthropic · ai-agents · autonomous-agents · react-loop · orchestration · multi-agent

Verified proof

How this fits the ecosystem

@agentskit/runtime is the headless agent engine: ReAct loops, tools, skills, delegation, memory, cancellation, and structured run results.

  • AgentsKit: compose it with the other packages in this repo to build agents from small, swappable parts.
  • Registry: look for ready agents and templates that already use this layer at registry.agentskit.io.
  • Playbook: learn the production patterns behind this layer at playbook.agentskit.io.

Docs: package guide · agent handoff

Why runtime

  • ReAct loop handled for you — observe, think, act, repeat: the runtime drives the full cycle and stops when the agent decides it's done
  • Structured, inspectable results — every run returns the final content, step count, all tool calls made, and total duration; no black boxes
  • Production-ready lifecycle — lazy tool init/dispose, AbortSignal cancellation, memory persistence, and AgentEvent emissions for observability
  • Multi-agent delegation — pass a planner skill with named delegates and the runtime coordinates sub-agents automatically

Install

npm install @agentskit/runtime @agentskit/adapters

Quick example

import { createRuntime } from '@agentskit/runtime'
import { openai } from '@agentskit/adapters'
import { webSearch, filesystem } from '@agentskit/tools'

const runtime = createRuntime({
  adapter: openai({ apiKey: process.env.OPENAI_API_KEY, model: 'gpt-4o' }),
  tools: [webSearch(), ...filesystem({ basePath: './workspace' })],
  systemPrompt: 'You are a helpful research assistant.',
})

const result = await runtime.run('Research the latest advances in quantum computing')
console.log(result.content)
console.log(`Completed in ${result.steps} steps, ${result.durationMs}ms`)

With skills

import { createRuntime } from '@agentskit/runtime'
import { anthropic } from '@agentskit/adapters'
import { researcher } from '@agentskit/skills'

const runtime = createRuntime({
  adapter: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY!, model: 'claude-sonnet-4-6' }),
})

const result = await runtime.run('Summarize REST vs GraphQL', { skill: researcher })
console.log(result.content)

Features

  • createRuntime — single entry point for headless agent execution.
  • ReAct loop: observe → think → act → repeat until done.
  • Returns { content, steps, toolCalls, durationMs } — fully inspectable.
  • AbortSignal cancellation support.
  • Tool init / dispose lifecycle hooks.
  • AgentEvent emissions for observability integrations.
  • retriever option for RAG context injection.

Advanced primitives

PrimitivePurposeDocs
createDurableRunner + createFileStepLogTemporal-style step log; resume on crashDurable execution
supervisor / swarm / hierarchical / blackboardReady-made multi-agent topologiesTopologies
speculateFan-out N adapters, race + abort losersSpeculative execution
createCronScheduler + createWebhookHandlerBackground agents, cron + webhooksBackground agents

Topology cancellation

AgentHandle.run(task, context?, signal?) receives cancellation separately from caller context; existing two-argument handles remain compatible. swarm has no per-member deadline unless timeoutMs is set, which must be finite, greater than 0, and no greater than 2,147,483,647 milliseconds. Invalid values throw ConfigError (AK_CONFIG_INVALID) synchronously. On deadline, the child signal is aborted and an optional legacy abort hook is called once on a best-effort basis; children must honor the signal to stop their work. If all members fail, swarm throws RuntimeError (AK_RUNTIME_DELEGATE_FAILED) with the first failure as its cause, including NetError (AK_NET_TIMEOUT) for a deadline. A child that ignores cancellation may continue after the swarm returns.

Ecosystem

PackageRole
@agentskit/corecreateRuntime contracts, Retriever
@agentskit/adaptersLLM adapters
@agentskit/toolsTool modules
@agentskit/skillsPre-built skills
@agentskit/ragretriever for context injection

Contributors

AgentsKit contributors

License

MIT — see LICENSE.

Docs

Full documentation · GitHub

Maturity and compatibility

  • Stability: beta — see docs/STABILITY.md
  • Node.js 20+ and TypeScript strict mode
  • Published as @agentskit/runtime

Contributing

See CONTRIBUTING.md and the monorepo LICENSE.

版本与发布记录

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

版本发布日期距今
0.11.3latest2026/10/2412 天前
0.11.22026/10/1026 天前
0.11.12026/10/031 个月前
0.11.02026/10/031 个月前
0.10.192026/09/291 个月前
0.10.182026/09/261 个月前

关于 @agentskit/runtime 的常见问题

@agentskit/runtime 是什么?

Standalone agent runtime with ReAct loop for AgentsKit.

如何安装 @agentskit/runtime?

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

@agentskit/runtime 支持 TypeScript 吗?

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

@agentskit/runtime 支持 ESM 还是 CommonJS?

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

@agentskit/runtime 需要什么版本的 Node.js?

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

@agentskit/runtime 可以商用吗?

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

@agentskit/runtime 的下载量有多少?

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

@agentskit/runtime 还在维护吗?

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