const messages = await agent.getHistory();
for (const m of messages) {
console.log(m.role, m.parts[0].content);
for (const call of m.toolCalls || []) {
console.log(" ", call.name, call.target, call.ok ? "ok" : "failed", call.credits);
}
}messages = agent.get_history()
# [{"role", "content", "name", "toolCallId"}] — read from the local journal
for m in messages:
if m["role"] == "tool":
print(" ", m["name"], (m["content"] or "")[:60])
else:
print(m["role"], (m["content"] or "")[:80])rolestringuser 或 assistant。工具信息不在里面。
partsarray[{ type: "text", content }] 相同的模式会话返回模式。
toolCallsarray{ id, name, target, ok, credits, durationMs } 电话,每次。
目标的参数的简短版本
有意义的字符串 —— 路径、 模式、 命令、 查询、 密钥。 它是一个界面在工具名称旁边显示什么, 以及一个会话记录是什么 。
从哪里来
| 代理 | 读取自 |
|---|---|
无 memory | 对象在内存中持有的 |
与 memory | 账户账户 |
工具结果从来就没有在工具中出现过
工具返回的文字内容在设备日记里, 其它地方也没有——这也是为什么在其他地方重新开会, 显示在未显示读到的东西的情况下所做的。
用于显示,而非重放
继续聊天,打 run() 代理器上——它已经维持了模型需要的状况。这个方法用来显示一个人发生的事情。