Skip to content

Interface: LoopNode<TIn, TOut, THandle, TActStepId> ​

Defined in: ast/loop-node.ts:74

Passive AST node representing an iterative action-and-evaluation refinement loop (P.loop(id)).

Repeatedly executes actStep followed by evaluateStep up to maxIterations times until evaluateStep.acceptWhen returns true, optionally preserving the actor transcript and distilling lessons.

Type Parameters ​

Type ParameterDefault typeDescription
TInunknownValidated loop input payload type.
TOutunknownValidated loop output payload type.
THandleunknownRuntime handle type of the active isolation scope.
TActStepId extends stringstringLiteral string type of the action step ID constrained by .returnOutputFrom(actStepId).

Properties ​

PropertyModifierTypeDescriptionDefined in
actStepreadonlyLoopActStepConfig<TIn, TOut, THandle, TActStepId>Action step configuration.ast/loop-node.ts:99
distillLessons?readonlyLessonsNode<unknown>Optional LessonsNode receiving contrastive loop recovery pairs and active evaluator violations.ast/loop-node.ts:97
evaluateStepreadonlyLoopEvaluateStepConfig<TIn, TOut, THandle>Evaluation step configuration.ast/loop-node.ts:101
extractPartitions?readonlyBivariantCallback<[input: TIn], readonly string[]>Optional synchronous partition extractor mapping TIn to active partition IDs.ast/loop-node.ts:91
idreadonlystringUnique identifier of the loop definition.ast/loop-node.ts:83
inputSchemareadonlyZodType<TIn>Zod schema validating loop input.ast/loop-node.ts:87
maxIterationsreadonlynumberMaximum number of .act() -> .evaluate() iterations before failing the loop.ast/loop-node.ts:93
outputSchemareadonlyZodType<TOut>Zod schema validating loop output.ast/loop-node.ts:89
preserveActorSessionreadonlybooleanTrue when rejected iterations resume the .act() actor's existing conversation transcript.ast/loop-node.ts:95
returnOutputFromStepIdreadonlyTActStepIdLiteral action step ID from which the loop projects its final accepted output.ast/loop-node.ts:103
roleKeyreadonlystringCanonical role key of the inner .act() actor (actStep.actor.roleKey).ast/loop-node.ts:85
typereadonly"harness:loop"Discriminant identifying an iterative refinement loop AST node.ast/loop-node.ts:81

Released under the MIT License.