feat(core): support multi-step doWhile/doUntil loops#1064
Conversation
🦋 Changeset detectedLatest commit: b55cd0a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This comment has been minimized.
This comment has been minimized.
📝 WalkthroughWalkthroughThe pull request adds multi-step loop support for Changes
Sequence DiagramsequenceDiagram
participant Executor as Loop Executor
participant Condition as Condition Check
participant Step1 as Step 1
participant Step2 as Step N
participant Tracing as Tracing/Metrics
rect rgba(100, 150, 200, 0.5)
Executor->>Condition: Evaluate condition with input
Condition-->>Executor: Continue? (boolean)
end
rect rgba(100, 150, 200, 0.5)
loop For each step in steps array
Executor->>Tracing: Record step index & loop iteration
Executor->>Step1: Execute with current data
Step1-->>Step2: Output data
Step2->>Step2: Transform data
Step2-->>Executor: Return modified data
end
end
rect rgba(100, 150, 200, 0.5)
Executor->>Condition: Re-evaluate with new data
Condition-->>Executor: Continue/Stop?
end
alt Condition met
Executor->>Executor: Next iteration
else Condition not met
Executor->>Executor: Exit loop
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying voltagent with
|
| Latest commit: |
b55cd0a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://37be1d62.voltagent.pages.dev |
| Branch Preview URL: | https://feat-workflow-multi-step-loo.voltagent.pages.dev |
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
andDoWhileandandDoUntilonly accept a singlestep. For multi-step loop bodies, users have to place all logic in oneandThen(...).executeblock.What is the new behavior?
andDoWhileandandDoUntilnow accept either:step(existing behavior, backward compatible)steps(new) for sequential multi-step loop bodiesEach iteration runs the configured steps in order and pipes each output into the next step.
Also updated loop step serialization to include
subStepswhen a loop has multiple steps.fixes (issue)
N/A
Notes for reviewers
stepusage.and-loop.spec.tsand type tests incore.spec-d.ts.website/docs/workflows/steps/and-loop.md..changeset/giant-coins-twirl.md.Validation run:
pnpm --filter @voltagent/core exec vitest run src/workflow/steps/and-loop.spec.ts src/workflow/core.spec-d.ts --typecheckSummary by cubic
Enable multi-step loop bodies for andDoWhile/andDoUntil. Each iteration can run multiple steps in order and pass outputs between them; single-step usage stays the same.
Written for commit b55cd0a. Summary will update on new commits.
Summary by CodeRabbit
Release Notes
New Features
Documentation