事件

tool_start

{ type: "tool_start", id, tool, category, args }

工具即将运行, 工具将使用它将运行的参数。 它会在任何许可批准后到达, 所以看到它就意味着电话正在响起。

after the permissionargs are finalpaired with tool_end
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

字段

idstring

电话识别码 tool_end 携带相同的。

toolstring

工具的名字。

categorystring

其 其 其 其 类别 ——根据其中六个理由计算。

argsobject

确切地说,它将运行。

平平

const started = new Map();

onEvent: (e) => {
  if (e.type === "tool_start") started.set(e.id, { tool: e.tool, at: Date.now(), args: e.args });
  if (e.type === "tool_end")   {
    const call = started.get(e.id);
    console.log(call.tool, e.ok ? "ok" : "failed", e.durationMs, "ms");
    started.delete(e.id);
  }
};
import time

started = {}

def on_event(event):
    if event["type"] == "tool_start":
        started[event["id"]] = {"tool": event["tool"], "at": time.monotonic(), "args": event["args"]}
    if event["type"] == "tool_end":
        call = started.pop(event["id"])
        print(call["tool"], "ok" if event["ok"] else "failed", round((time.monotonic() - call["at"]) * 1000), "ms")
并非每个 tool_end 具有 a 的 tool_start

拒绝的呼叫和呼叫未知工具仅发出 tool_end。通过 id 来对准和容忍一个没有开始的结束,或者一个摇晃的入口将永远坐在你的地图上。

几个可以同时打开

转而每个呼唤都响起 read 或 a task引擎一起运行,这样你可以看到几个 tool_start 第一个 tool_end,结束以完成顺序而不是呼叫顺序到达。 id 是什么使这无害。

参数是显示

args.path, args.command, args.query, args.pattern, args.key ——一个有意义的字符串是界面在工具名称旁边显示的。会话记录保持与短 目标目标目标.

子智能体事件也会传递到这里

它们随身携带 palclId —— 启动它们的任务电话的识别符号 —— 以及代理、 其名称。 他们自己的代号与任务名称相加, 所以两个运行时不会相撞 。 在将事件作为主运行程序处理之前先测试 palId 。