Member Junction
    Preparing search index...

    Universal ForEach loop configuration used by all agent types. Flow agents convert AIAgentStep configuration to this format. Loop agents receive this from LLM responses.

    2.112.0

    interface ForEachOperation {
        action?: {
            name: string;
            outputMapping?: string;
            params: Record<string, unknown>;
        };
        collectionPath: string;
        continueOnError?: boolean;
        delayBetweenIterationsMs?: number;
        executionMode?: "sequential"
        | "parallel";
        indexVariable?: string;
        itemVariable?: string;
        maxConcurrency?: number;
        maxIterations?: number;
        subAgent?: {
            context?: unknown;
            message: string;
            name: string;
            templateParameters?: Record<string, string>;
        };
    }
    Index

    Properties

    action?: {
        name: string;
        outputMapping?: string;
        params: Record<string, unknown>;
    }

    Execute action per iteration

    collectionPath: string

    Path in payload to array to iterate over

    continueOnError?: boolean

    Continue processing if an iteration fails (default: false)

    delayBetweenIterationsMs?: number

    Delay between iterations in milliseconds (default: 0)

    executionMode?: "sequential" | "parallel"

    Execution mode for iterations (default: 'sequential')

    • 'sequential': Process iterations one at a time in order (safest, maintains order, good for state accumulation)
    • 'parallel': Process multiple iterations concurrently (faster for independent operations like web scraping, API calls)

    2.113.0

    indexVariable?: string

    Variable name for loop index (default: "index")

    itemVariable?: string

    Variable name for current item (default: "item")

    maxConcurrency?: number

    Maximum number of iterations to process concurrently when executionMode='parallel' (default: 10) Only applies when executionMode='parallel'. Controls batch size to prevent resource exhaustion. Recommended values:

    • I/O-bound operations (API calls, web scraping): 10-20
    • CPU-bound operations (data processing): CPU core count
    • Sub-agent spawning: 2-5 (agents are resource-intensive)

    2.113.0

    maxIterations?: number

    Maximum iterations (undefined=1000, 0=unlimited, >0=limit)

    subAgent?: {
        context?: unknown;
        message: string;
        name: string;
        templateParameters?: Record<string, string>;
    }

    Execute sub-agent per iteration

    Type Declaration

    • Optionalcontext?: unknown

      Runtime context propagated to the sub-agent. Allows sub-agents to access API keys, environment settings, and other runtime configuration from the parent agent.

      2.127.0

    • message: string
    • name: string
    • OptionaltemplateParameters?: Record<string, string>