mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
fix(AI Agent Node): Fix tool calling when tools run in a loop (#15250)
Co-authored-by: JP van Oosten <jp@n8n.io> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
committed by
GitHub
parent
52f27a76ac
commit
cd1d6c9dfc
@@ -60,17 +60,21 @@ export class WorkflowToolService {
|
||||
|
||||
// Creates the tool based on the provided parameters
|
||||
async createTool({
|
||||
ctx,
|
||||
name,
|
||||
description,
|
||||
itemIndex,
|
||||
}: {
|
||||
ctx: ISupplyDataFunctions;
|
||||
name: string;
|
||||
description: string;
|
||||
itemIndex: number;
|
||||
}): Promise<DynamicTool | DynamicStructuredTool> {
|
||||
let runIndex = 0;
|
||||
// Handler for the tool execution, will be called when the tool is executed
|
||||
// This function will execute the sub-workflow and return the response
|
||||
// We get the runIndex from the context to handle multiple executions
|
||||
// of the same tool when the tool is used in a loop or in a parallel execution.
|
||||
let runIndex: number = ctx.getNextRunIndex();
|
||||
const toolHandler = async (
|
||||
query: string | IDataObject,
|
||||
runManager?: CallbackManagerForToolRun,
|
||||
|
||||
Reference in New Issue
Block a user