[AI] Collapse NativeToolBinder to a single bind() entry (#20051)

The binder doesnt need an agent or full tool context -- just a model and
options.
Single `bind(model, options)` entry!


Builds on #20022.
This commit is contained in:
nitin
2026-04-27 20:05:59 +05:30
committed by GitHub
parent 13aaea597e
commit bb5f294c5a
6 changed files with 13 additions and 44 deletions
@@ -150,7 +150,6 @@ export class AgentAsyncExecutorService {
rolePermissionConfig: effectiveRoleConfig ?? { unionOf: [] },
authContext,
actorContext,
agent: agent as unknown as ToolProviderContext['agent'],
userId:
isDefined(authContext) && isUserAuthContext(authContext)
? authContext.user.id
@@ -169,8 +168,10 @@ export class AgentAsyncExecutorService {
},
);
const nativeTools =
await this.nativeToolBinder.bind(toolProviderContext);
const nativeTools = this.nativeToolBinder.bind(registeredModel, {
webSearchEnabled:
agent.modelConfiguration?.webSearch?.enabled === true,
});
tools = {
...registryTools,
@@ -157,10 +157,9 @@ export class ChatExecutionService {
registeredModel.modelId,
);
const nativeModelTools = this.nativeToolBinder.bindForModel(
registeredModel,
{ webSearchEnabled: true },
);
const nativeModelTools = this.nativeToolBinder.bind(registeredModel, {
webSearchEnabled: true,
});
// Tools the model can call directly: preloaded registry tools (already
// serialized by the hydrator) plus SDK-native tools (opaque, never
@@ -79,15 +79,6 @@ export class AiModelConfigService {
return tools;
}
getNativeModelToolsForAgent(
model: RegisteredAiModel,
agent: FlatAgentWithRoleId,
): ToolSet {
return this.getNativeModelTools(model, {
webSearchEnabled: agent.modelConfiguration?.webSearch?.enabled === true,
});
}
private getXaiProviderOptions(agent: FlatAgentWithRoleId): ProviderOptions {
if (
!agent.modelConfiguration ||