$result->run->stopReason 和规范化用量,以便应用区分预算触发的停止与模型正常结束。
停止是一个有界结果,不会自动视为异常。请决定产品要将哪些停止原因视为成功、可重试或展示给用户。Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
按步骤数、令牌数、成本、时长、工具或结束原因限制 PHP Agent 运行。
$agent = AgentSdk::createAgent(new AgentDefinition(
id: "bounded-research",
model: "openai/gpt-5.4-nano",
stopWhen: [
AgentSdk::stepCountIs(12),
AgentSdk::maxTokensUsed(40000),
AgentSdk::maxCost(2.50),
AgentSdk::maxDuration(120000),
]
));
$result->run->stopReason 和规范化用量,以便应用区分预算触发的停止与模型正常结束。
停止是一个有界结果,不会自动视为异常。请决定产品要将哪些停止原因视为成功、可重试或展示给用户。