messagestringالنص. inputs.
inputsarray[{ type: "text", content }, { type: "image", content: base64, mime }].
historyarray[{ role, content }] -محادثة سابقة، لعميل بدون جلسة
onEventfunctionكل ما من حدث حدثلم ينتظر أبداً؛ أي شيء يرميه يبتلع
editintegerارجع إلى الرسالة أولاً ثم شغل مع نص جديد.
One of message and inputs is required — neither, and it throws 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 تاريخ الدورة ينتصر، وهذا هو تجاهل - وهو الشكل الصحيح عندما تكون المحادثة ملك لقاعدة بياناتك وليس لقاعدة بياناتنا.
edit: changing an earlier message
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()