RunAgentOptions
runAgent 的选项(注入档):调用方自带 client / model,可选自带工具定义与执行器、系统提示、
历史前缀;其余为查询环护栏(轮数 / 工具轮 / 连续错误)、压缩接线与采样参数直通。
client
Section titled “client”client: ModelClient;模型客户端(调用方自带;测试可传 scripted client)
compaction?
Section titled “compaction?”optional compaction?: QueryCompactionOptions;上下文压缩接线(提供即启用;kernel 压缩语义直通)
contextWindowTokens?
Section titled “contextWindowTokens?”optional contextWindowTokens?: number;模型上下文窗口 token 数(水位分母;缺省事件不落键)
executor?
Section titled “executor?”optional executor?: ToolExecutor;工具执行缝;缺省 fail-safe 空执行器(任何工具调用产出结构化 unknown_tool 失败结果,查询环照常回填继续,不 throw)。
initialMessages?
Section titled “initialMessages?”optional initialMessages?: readonly IRMessage[];历史前缀(多轮续跑/恢复);与 prompt 至少给一个非空
maxConsecutiveErrors?
Section titled “maxConsecutiveErrors?”optional maxConsecutiveErrors?: number;连续可恢复错误熔断上限;缺省 3(内核缺省)
maxOutputTokens?
Section titled “maxOutputTokens?”optional maxOutputTokens?: number;模型输出上限 capability.maxOutput(查询环事前钳制 maxTokens;缺省不钳)
maxTokens?
Section titled “maxTokens?”optional maxTokens?: number;缺省 8192
maxToolRounds?
Section titled “maxToolRounds?”optional maxToolRounds?: number;toolRounds 上限;缺省不设
maxTurns?
Section titled “maxTurns?”optional maxTurns?: number;modelTurns 上限(防失控;缺省不设)
model: ResolvedModel;送 wire 的模型标识
prompt?
Section titled “prompt?”optional prompt?: string;单轮输入(追加在 initialMessages 之后作最后一条 user 消息)
sessionId?
Section titled “sessionId?”optional sessionId?: string;缺省 randomUUID()
signal?
Section titled “signal?”optional signal?: any;外部中断信号(全链透传:模型流 / 工具执行 / 压缩均立即响应)
stopSequences?
Section titled “stopSequences?”optional stopSequences?: string[];system?
Section titled “system?”optional system?: IRSystemSegment[];系统提示;缺省空
temperature?
Section titled “temperature?”optional temperature?: number;采样参数直通
thinking?
Section titled “thinking?”optional thinking?: { budget?: number;};budget?
Section titled “budget?”optional budget?: number;tools?
Section titled “tools?”optional tools?: IRToolDef[];模型可见工具定义;缺省空
本文是否有帮助?
感谢反馈,我们会持续改进这篇文章。