mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-14 14:38:51 +01:00
chore: update @librechat/agents dependency to version 3.0.71 and enhance agent tool loading logic
- Updated the @librechat/agents package to version 3.0.71 across multiple files. - Added support for handling deferred loading of tools in agent initialization and execution processes. - Improved the extraction of discovered tools from message history to optimize tool loading behavior.
This commit is contained in:
parent
1496e11e88
commit
4a6c2aa1e8
8 changed files with 179 additions and 14 deletions
|
|
@ -335,6 +335,8 @@ export interface BuildToolClassificationResult {
|
|||
toolRegistry?: LCToolRegistry;
|
||||
/** Additional tools created (PTC and/or tool search) */
|
||||
additionalTools: GenericTool[];
|
||||
/** Whether any tools have defer_loading enabled (precomputed for efficiency) */
|
||||
hasDeferredTools: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -410,12 +412,12 @@ export async function buildToolClassification(
|
|||
logger.debug(
|
||||
`[buildToolClassification] Agent ${agentId ?? 'undefined'} not allowed for classification, skipping`,
|
||||
);
|
||||
return { toolRegistry: undefined, additionalTools };
|
||||
return { toolRegistry: undefined, additionalTools, hasDeferredTools: false };
|
||||
}
|
||||
|
||||
const mcpTools = loadedTools.filter(isMCPTool);
|
||||
if (mcpTools.length === 0) {
|
||||
return { toolRegistry: undefined, additionalTools };
|
||||
return { toolRegistry: undefined, additionalTools, hasDeferredTools: false };
|
||||
}
|
||||
|
||||
const mcpToolDefs = mcpTools.map(extractMCPToolDefinition);
|
||||
|
|
@ -433,7 +435,7 @@ export async function buildToolClassification(
|
|||
toolRegistry = buildToolRegistryFromEnv(mcpToolDefs);
|
||||
} else {
|
||||
/** No agent-level config and env-based classification not enabled */
|
||||
return { toolRegistry: undefined, additionalTools };
|
||||
return { toolRegistry: undefined, additionalTools, hasDeferredTools: false };
|
||||
}
|
||||
|
||||
/** Clean up temporary mcpJsonSchema property from tools now that registry is populated */
|
||||
|
|
@ -451,7 +453,7 @@ export async function buildToolClassification(
|
|||
logger.debug(
|
||||
`[buildToolClassification] Agent ${agentId} has no programmatic or deferred tools, skipping PTC/ToolSearch`,
|
||||
);
|
||||
return { toolRegistry, additionalTools };
|
||||
return { toolRegistry, additionalTools, hasDeferredTools: false };
|
||||
}
|
||||
|
||||
/** Tool search uses local mode (no API key needed) */
|
||||
|
|
@ -485,5 +487,5 @@ export async function buildToolClassification(
|
|||
}
|
||||
}
|
||||
|
||||
return { toolRegistry, additionalTools };
|
||||
return { toolRegistry, additionalTools, hasDeferredTools };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue