Skip to content
全部能力
AI 运行时packages/ai/agent-runtime

agent-runtime 能力包

更底层的 agent 执行 — message reducer、tool 调用、流式状态机;@nebutra/agents 在其之上封装。

打开文档
稳定性
稳定
作用域
全局
边界
packages/ai/agent-runtime
Agent 执行claude-sonnet-4-6
Ready
  1. 用户提问查找最近欧区注册并通知团队
  2. 模型推理规划中 · 412 tokens
  3. tool_callsearch_users({ region: 'eu', since: '7d' })
  4. tool_result→ 23 条 · 184 ms
  5. tool_callsend_email({ to: 'team@', body: ... })
  6. tool_result→ ok · message_id=msg_8f2a
  7. 最终回复已发送欧区注册摘要给团队(23 条)。

步骤

7

Tokens

1,247

耗时

2.3s

工具调用

2

已完成
使用方式agent-runtime.ts
typescript
agent-runtime.ts
1import { AgentRuntime } from "@nebutra/agent-runtime";
2
3const runtime = new AgentRuntime({
4  model: "claude-sonnet-4-6",
5  durable: { store: "redis", ttl: "7d" },
6  hooks: {
7    onBeforeTool: ({ name, args }) => console.log("tool:", name),
8    onTurnComplete: ({ usage }) => meterUsage(usage),
9  },
10});
11
12const turn = await runtime.run({
13  prompt: "Refund the order placed yesterday",
14  tools: [refundTool, lookupOrderTool],
15  maxSteps: 8,
16});