服务端智能体

run()

agent.run({ inputs, outputs?, history?, onStep?, signal? }) → Promise<Result>

流出平台的运行:每步回调一次, 以及当它结束时的结果 。

POST /api/ai/agents/runserver-sent eventserrors keep their type
Using Python?

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

inputsarray必填

[{ type: "text", content }],包括图像。空阵列投出。

outputsarray

覆盖了代理器创建的用途, 本次运行。

historyarray

缺席使用代理人自己的; [] 重新开始。

onStepfunction

每一步都按步调来

signalAbortSignal

取消请求。

采取什么步骤

{
  index: 2,
  kind: "tool",
  tool: "search",
  input: "customer churn definition",
  reasoning: "I will look up how they define churn.",
  summary: "5 result(s)",
  error: "",
  credits: 7,
  durationMs: 1840,
  meta: { enginesUsed: [...], results: [...] }
}
{
    "index": 2,
    "kind": "tool",
    "tool": "search",
    "input": "customer churn definition",
    "reasoning": "I will look up how they define churn.",
    "summary": "5 result(s)",
    "error": "",
    "credits": 7,
    "durationMs": 1840,
    "meta": {"enginesUsed": [...], "results": [...]},
}

credits 跑步是全速跑,不是这步 meta 无论工具报告什么——它打开的页面、它找到的来源、一代人的数字。

三起拒绝 算作一步错误

错误触发条件
未知工具标有您没有声明的模型。 信件列出了可用的 。
缺少的论点一种需要工具的工具被称作没有它的工具。
已经做同一工具,同一论点,两次。
拒绝:.所需信贷宣布的费用将过 budget.

每一个都持续跑步,拒绝就是模式可以采取行动的信息。

错误将类型保留在流中

import { NotEnoughCredits, Unauthorized, IaGenifyError } from "iagenify";

try {
  await agent.run({ inputs });
} catch (err) {
  if (err instanceof NotEnoughCredits) { /* … */ }
}
from iagenify import IaGenifyError, NotEnoughCredits, Unauthorized

try:
    agent.run(inputs=inputs)
except NotEnoughCredits:
    pass  # …
流流中的失败被翻译回来

旅行时间为 JSON,并且被重建成同一类 , 剩下的软件包扔出—— 如此一来这里的工作就和其他地方一样, 而不是给你一个简单的错误, 而不是给您一个网络故障无法告诉的错误。

不明内嵌内设被断断拒绝

工具 builtin 平台不知道运行失败,而不是被丢弃。 悄悄地缺少其周围工具的工作流程就是没有人诊断出失败。

本地工作暂停运行

当一个步骤需要打电话者的电脑时, 运行请求并等待您的进程回答。 放弃请求, 而该步骤永远无法完成 。