feat: implement scheduling functionality for AgentflowV2#5971
feat: implement scheduling functionality for AgentflowV2#5971prd-hoang-doan wants to merge 4 commits intoFlowiseAI:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a robust scheduling system for Agentflows, enabling users to define recurring execution times directly within the Agentflow Start node. It provides a user-friendly interface for setting schedules via cron expressions or a visual picker, backed by a resilient backend that persists these configurations and manages their execution through either a message queue or an in-process timer. This enhancement significantly expands the automation capabilities of Agentflows, allowing for time-based triggers without manual intervention. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive scheduling feature for Agentflows, including UI for configuration, database persistence, and a backend scheduler supporting both queue and non-queue modes. The implementation is well-structured, with clear separation of concerns. I have two main points of feedback: one regarding the robustness of the cron expression validation, which could be improved by breaking down complex regex into simpler, individual validations for better readability and error prevention, and another to improve code clarity by simplifying a method signature and its call sites.
184b994 to
42595f3
Compare
|
Thanks @prd-hoang-doan for this PR. We are working on a similar request and I will be testing it this week. Will reach out to you soon. |
|
@prd-hoang-doan Thanks for implementing this, this is great. Just a few things we want addressed before we merge. I split them up into bugs that need fixing and nice-to-have follow-ups. Bugs1.
|
|
@jchui-wd Thanks for the quick and detailed feedback — I’m glad to receive it.
Please let me know if you’d prefer me to prioritize any item differently. Thanks again! |
|
@prd-hoang-doan Let's just add the disable toggle in the red box area. Thanks a lot. |
|
Thanks for this, any order is alright. We will update our CONTRIBUTING.MD with proper testing standard soon, will follow up shortly. |
42595f3 to
d13799f
Compare
|
Hey @prd-hoang-doan, we updated our Contributing.md with a testing section: Let us know if you have any questions / concerns. |
|
@jchui-wd Sure, I’ll create the unit tests following your instruction. Thanks for the update. |
- Added ScheduleQueue class for managing scheduled jobs using BullMQ. - Introduced scheduleService for creating, updating, and disabling schedules. - Integrated schedule validation and cron expression handling. - Enhanced chatflow service to manage schedules for agentflows. - Added UI components for time and day selection (TimePicker, WeekDaysPicker, MonthDaysPicker). - Updated NodeInputHandler to support new input types for scheduling. - Improved validation for schedule configurations in agentflows.
- Refactor ScheduleQueue to utilize executeScheduleJob for job execution. - Add new endpoints for schedule status retrieval and enabling/disabling schedules in chatflows. - Update chatflow service to handle schedule creation, updates, and deletions more effectively. - Introduce DatePicker component for date input in UI. - Enhance CanvasHeader to manage schedule state and toggle functionality. - Integrate schedule validation logic to ensure proper configuration before enabling schedules. - Update dependencies to include node-cron for improved scheduling capabilities.
a4eeead to
529b35d
Compare
- Seperate the utils function from schedule service. - Created comprehensive unit tests for all utility functions in `utils.test.ts`, covering various scenarios for cron expression validation, visual picker validation, and schedule resolution. - Ensured proper handling of edge cases and error messages for invalid inputs.
- Seperate the utils function from schedule service. - Created comprehensive unit tests for all utility functions in utils.test.ts, covering various scenarios for cron expression validation, visual picker validation, and schedule resolution. - Ensured proper handling of edge cases and error messages for invalid inputs.
|
@jchui-wd @harshit-flowise , I updated the pull requests based on @jchui-wd suggestion. The PR includes bug fixes (except point #4). It seems that our current logic only deletes the last sessions (I tried opening multiple profiles with the same account). Users can delete all by viewing all messages, then clicking Delete All. Besides, I also implemented nice-to-have things:
Please take your time reviewing my pull requests, and feel free to share your feedback. |




Ticket:
Flowise Roadmap
Overview
Adds first-class scheduled execution for Agentflows, including UI inputs for schedule configuration and a backend scheduler that can run via BullMQ (queue mode) or an in-process timer (non-queue mode).
agentflow-schedule.mov
Changes
Database
schedule_recordschedule_trigger_logNotesRecording Demo:
Youtube: https://youtu.be/MZ1ws7XqsBg
This PR includes a new migration for the scheduling entities. Please take a look when you have time, and feel free to share any feedback if changes are needed.