Added maxIterations to serialized loops, executor now uses provided max iterations for each loop from workflow store

This commit is contained in:
Waleed Latif
2025-02-12 11:24:51 -08:00
parent 660a203c75
commit ac28e09b51
2 changed files with 2 additions and 2 deletions
+1 -2
View File
@@ -88,7 +88,6 @@ export class Executor {
*/
private async executeInParallel(context: ExecutionContext): Promise<BlockOutput> {
const { blocks, connections } = this.workflow
const MAX_ITERATIONS = 2 // Add safety limit for loops
// Track iterations per loop
const loopIterations = new Map<string, number>()
@@ -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)
+1
View File
@@ -42,4 +42,5 @@ export interface SerializedBlock {
export interface SerializedLoop {
id: string
nodes: string[]
maxIterations: number
}