feat(workflow): add observer/watch APIs for workflow streams#1100
feat(workflow): add observer/watch APIs for workflow streams#1100
Conversation
🦋 Changeset detectedLatest commit: 66c152f 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.
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughThis PR introduces observer-based streaming APIs for workflow stream results, enabling callback-based event subscriptions and readable stream consumption without blocking main iteration. New methods include Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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: |
66c152f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://328132e1.voltagent.pages.dev |
| Branch Preview URL: | https://feat-workflow-observer-watch.voltagent.pages.dev |
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
Workflow stream consumers can only observe events via the main async iterator (
for await ... of stream).There is no callback-based watch API, no
ReadableStreamobserver surface, and no legacy bridge method onWorkflowStreamResult.What is the new behavior?
Adds observer/watch APIs to workflow stream results:
watch(cb)watchAsync(cb)observeStream()streamLegacy()Available on:
workflow.stream(...)workflow.timeTravelStream(...).resume(...)Also includes:
WorkflowStreamControllersubscription registry + callback isolationwebsite/docs/workflows/streaming.mdincluding SDK-only note for watch APIs and REST SSE equivalentsfixes (issue)
N/A
Notes for reviewers
Validation run:
pnpm --filter @voltagent/core test -- src/workflow/stream.spec.ts src/workflow/core.spec.tsScope note:
docs/workflow-parity-plans/*intentionally not included in this PR.Summary by cubic
Adds callback-based observers and a ReadableStream view to workflow streams so clients can watch events without consuming the async iterator. Improves integration options and keeps existing iterator behavior unchanged.
Written for commit 66c152f. Summary will update on new commits.
Summary by CodeRabbit
New Features
watch(),watchAsync(),observeStream(), andstreamLegacy()enable non-destructive subscription to stream events and workflow state retrieval.Tests
Documentation