محل & محلي

نظرة عامة

ما يعني api.agents.create({ runtime: "local" }) العامل حلقة ك كائن أنت عقد تشغيل توقّف تفتيش و إعادة.

8 methodsthe loop is hereread its state as it works
Using Python?

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

الدالةالوظيفة
(د)تبادل واحد: رسالتك في، والإجابة خارج.
(ب) (ب) (ب) (ب)يُنهي التشغيل الحالي.
%التغييرات في النمط، في منتصف التشغيل، بما في ذلك الكوادر الفرعية.
(أ) 0يلخص المحادثة الآن
انت حصل تاريخالمحادثة، في شكل عرض.
نقاط التفتيش ((حيث يمكنك العودة إلى.
يعود إلى رسالة
(أ)يزيل الجلسة.
const agent = api.agents.create({ runtime: "local", machine: pc, model, memory: true });

const result = await agent.run({
  message: "Read the notes and list what is unfinished.",
  onEvent: (e) => { if (e.type === "text_delta") process.stdout.write(e.delta); },
});

console.log(agent.usage, agent.context.tokens, result.stopReason);
agent = api.agents.create(runtime="local", machine=pc, model=model, memory=True)

result = agent.run(
    message="Read the notes and list what is unfinished.",
    on_event=lambda e: print(e["text"]) if e["type"] == "text" else None,
)

print(agent.usage, agent.context["tokens"], result["stopReason"])

هو تبادل واحد، لا تنفيذ واحد

فهو يأخذ رسالتك ، حلقاتك حتى يتوقف النموذج عن طلب الأدوات ، ويرجع ، ويعاود الاتصال بها مرة اخرى يستمر في نفس المحادثة ، فالموضوع يحمل التاريخ .

هذا الكائن قابل لإعادة الاستخدام، وليس متزامناً

واحد في كل مرة

A ثانية ركض بينما هو بوصة طيران نفس رسالة قائمة قائمة و استخدام الأول أو بناء a ثانية وكيل.

يمكنك قراءة حالتها أثناء عملها

usage, context, todos, mode and messages are live. An interface can poll them, or listen to events, which is cheaper and more precise.