messagestring文本. 简简形式 inputs.
inputsarray[{ type: "text", content }, { type: "image", content: base64, mime }].
historyarray[{ role, content }] - 之前的谈话, 对于一个代理没有治疗。
onEventfunction接收每个 事件事件从未等待过;扔的东西被吞没。
editinteger先回到该信件, 然后用新文本运行 。
其中一个 message 和 inputs 既无所需要,也无所需要,而且抛掷 inputs_required.
发送图像
await agent.run({
inputs: [
{ type: "text", content: "What is wrong with this layout?" },
{ type: "image", content: base64, mime: "image/png" },
],
});agent.run(inputs=[
{"type": "text", "content": "What is wrong with this layout?"},
{"type": "image", "content": base64_png, "mime": "image/png"},
])返回值
{
text: "I read the four notes. Two are unfinished: …",
todos: [{ content: "Check the figures", status: "completed" }],
usage: { credits: 31, turns: 6, toolCalls: 9 },
stopReason: "end_turn", // "stopped" | "max_steps" | "budget"
model: "gemini-3.5-flash"
}{
"text": "I read the four notes. Two are unfinished: …",
"todos": [{"content": "Check the figures", "status": "completed"}],
"usage": {"credits": 31, "turns": 6, "toolCalls": 9},
"stopReason": "end_turn", # "stopped" | "max_steps" | "budget"
"model": "gemini-3.5-flash",
"context": {}, # the context meter, as in agent.context
}使用文本前读取停止站
仅 end_turn 意思是模型完成了 说它必须说的话。 max_steps 或预算, 文本是它上个写过的东西—— 可能是计划中。
历史, 对于没有会话的代理
和他谈话的种子 和他没有关系 memory: true 讨论会本身的历史获胜,而这一点却被忽视了——这是对话属于你们数据库而不是我们数据库的正确形式。
编辑: 修改早期消息
await agent.run({
edit: 2,
message: "Actually, rename them to kebab-case.",
});agent.run(
edit=2,
message="Actually, rename them to kebab-case.",
)内容在信息2——包括文件——发出之前 rewound,然后用新文本运行。它需要会话和检查点,如果其中之一缺失,在开始之前就会扔掉。
是什么使它拒绝
每一次重试后,每个模式都失败的转折、不合适的背景、未经授权的会话或拒绝信贷,其他所有东西——一个扔工具、一个被拒绝的工具——都在循环中处理,这里从来不浮出水面。
import { NotEnoughCredits, IaGenifyError } from "iagenify";
try {
await agent.run({ message });
} catch (err) {
if (err instanceof NotEnoughCredits) { /* never retried, on any model */ }
else if (err instanceof IaGenifyError && err.code === "context_too_large") await agent.compact();
else throw err;
}from iagenify import IaGenifyError, NotEnoughCredits
try:
agent.run(message=message)
except NotEnoughCredits:
pass # never retried, on any model
except IaGenifyError as error:
if error.code != "context_too_large":
raise
agent.compact()