diff --git a/executor/index.ts b/executor/index.ts index 1906b3bc25..ff3526a0d2 100644 --- a/executor/index.ts +++ b/executor/index.ts @@ -88,7 +88,6 @@ export class Executor { */ private async executeInParallel(context: ExecutionContext): Promise { const { blocks, connections } = this.workflow - const MAX_ITERATIONS = 2 // Add safety limit for loops // Track iterations per loop const loopIterations = new Map() @@ -315,7 +314,7 @@ export class Executor { if (executedLoopBlocks.length > 0) { const iterations = loopIterations.get(loopId) || 0 - if (iterations < MAX_ITERATIONS) { + if (iterations < (loop.maxIterations ?? 5)) { // Check if the evaluator chose a block within the loop const evaluatorInLoop = executedLoopBlocks.find((blockId) => { const block = blocks.find((b) => b.id === blockId) diff --git a/serializer/types.ts b/serializer/types.ts index 7bc20749b8..a33efb60df 100644 --- a/serializer/types.ts +++ b/serializer/types.ts @@ -42,4 +42,5 @@ export interface SerializedBlock { export interface SerializedLoop { id: string nodes: string[] + maxIterations: number }