Description
Follow-up to #18478: the fix in #18482 added 'reasoning' to the two prepareCall Pick lists in packages/ai/src/agent/tool-loop-agent-settings.ts, but the same mismatch exists for other settings keys. The runtime contract is unchanged: prepareCall receives { ...settingsWithoutCallbacks, ...options } where only the ten on* callbacks are stripped, and its return value is spread wholesale into the generateText/streamText call. So every non-callback settings key is present on the input and honored on the return, yet these are missing from both Pick lists:
toolChoice: reading settings.toolChoice is TS2339 while the runtime value is there, and returning an override works (a returned toolChoice: 'none' reaches doGenerate as { type: 'none' }). Forcing or disabling tools based on call options is a core prepareCall use case.
maxRetries: same shape; the settings value is present at runtime and generateText accepts a returned override.
prepareStep: same; returning a per-call step configuration is a natural pattern for agents whose behavior varies per call.
repairToolCall (and the deprecated experimental_repairToolCall): same.
Expected: these keys added to both Pick lists, as #18482 did for reasoning. Happy to open a PR.
Related, in case it should be handled in the same pass: the input type is Omit<AgentCallParameters<...>, 'onStepEnd' | 'onStepFinish'> & Pick<...>, so it still advertises abortSignal, onStart, onEnd, and the other call-level callbacks. Those are destructured out before prepareCall is invoked and can never be present; they are optional so this compiles, but e.g. reading options.abortSignal to wire up cancellation silently yields undefined forever. Widening the Omit would make the input type match the runtime in both directions.
Reproduction
import { ToolLoopAgent } from 'ai';
new ToolLoopAgent({
model: 'openai/gpt-5.2',
toolChoice: 'auto', // OK: the constructor accepts all four
maxRetries: 5,
prepareStep: () => undefined,
repairToolCall: async () => null,
prepareCall: settings => ({
...settings,
toolChoice: settings.toolChoice, // TS2339, runtime value: 'auto'
maxRetries: settings.maxRetries, // TS2339, runtime value: 5
prepareStep: settings.prepareStep, // TS2339
repairToolCall: settings.repairToolCall, // TS2339
reasoning: settings.reasoning, // OK since #18482
}),
});
AI SDK Version
- ai: 7.0.55 (Pick lists unchanged on current main)
Description
Follow-up to #18478: the fix in #18482 added
'reasoning'to the twoprepareCallPick lists inpackages/ai/src/agent/tool-loop-agent-settings.ts, but the same mismatch exists for other settings keys. The runtime contract is unchanged:prepareCallreceives{ ...settingsWithoutCallbacks, ...options }where only the tenon*callbacks are stripped, and its return value is spread wholesale into thegenerateText/streamTextcall. So every non-callback settings key is present on the input and honored on the return, yet these are missing from both Pick lists:toolChoice: readingsettings.toolChoiceis TS2339 while the runtime value is there, and returning an override works (a returnedtoolChoice: 'none'reachesdoGenerateas{ type: 'none' }). Forcing or disabling tools based on call options is a coreprepareCalluse case.maxRetries: same shape; the settings value is present at runtime andgenerateTextaccepts a returned override.prepareStep: same; returning a per-call step configuration is a natural pattern for agents whose behavior varies per call.repairToolCall(and the deprecatedexperimental_repairToolCall): same.Expected: these keys added to both Pick lists, as #18482 did for
reasoning. Happy to open a PR.Related, in case it should be handled in the same pass: the input type is
Omit<AgentCallParameters<...>, 'onStepEnd' | 'onStepFinish'> & Pick<...>, so it still advertisesabortSignal,onStart,onEnd, and the other call-level callbacks. Those are destructured out beforeprepareCallis invoked and can never be present; they are optional so this compiles, but e.g. readingoptions.abortSignalto wire up cancellation silently yieldsundefinedforever. Widening theOmitwould make the input type match the runtime in both directions.Reproduction
AI SDK Version