Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous Processing in Workflows? #11805

Open
4 of 5 tasks
G81192 opened this issue Dec 18, 2024 · 5 comments
Open
4 of 5 tasks

Asynchronous Processing in Workflows? #11805

G81192 opened this issue Dec 18, 2024 · 5 comments
Labels
🌊 feat:workflow Workflow related stuff.

Comments

@G81192
Copy link
Contributor

G81192 commented Dec 18, 2024

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

hi, In the Dify workflow, I would like to know if it's possible to implement an asynchronous mechanism. Specifically, I want tasks to be processed asynchronously after a user receives a response, without requiring the user to wait for the results of those tasks.

For example, I have a requirement where, at the end of a workflow, I need to evaluate the quality of the response using a large language model (LLM). This evaluation process should happen asynchronously, and the user does not need to wait for its completion.

Is there currently a feature or method in Dify that supports this use case? If not, could you suggest an alternative way to achieve this functionality? The goal is to send the question, the response, and the knowledge to the LLM for evaluation based on specified dimensions, all while keeping this process independent of the main workflow response.

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
@dosubot dosubot bot added the 🌊 feat:workflow Workflow related stuff. label Dec 18, 2024
@kiendn1
Copy link

kiendn1 commented Dec 19, 2024

@G81192
Copy link
Contributor Author

G81192 commented Dec 19, 2024

You can try parallel branch. https://dify.ai/blog/accelerating-workflow-processing-with-parallel-branch

@kiendn1 Thank you for your suggestion. I tried using the parallel branch approach, but it doesn't fully solve the issue. Although the user has already received a response, the workflow hasn't finished yet, and the user has to wait continuously. This creates a very poor experience, which is even intolerable. I would like the asynchronous process to be completely transparent to the user, so they don't feel any delay or impact.

@G81192
Copy link
Contributor Author

G81192 commented Dec 24, 2024

@GarfieldDai
hi, could you give me some advice on this issue?

@crazywoola
Copy link
Member

If you can append a HTTP service at the end of the workflow.

The HTTP service should look like this:

def async_task
    queue.add(task)
    return 200 "success"

@G81192
Copy link
Contributor Author

G81192 commented Dec 25, 2024

If you can append a HTTP service at the end of the workflow.

The HTTP service should look like this:

def async_task
    queue.add(task)
    return 200 "success"

@crazywoola Thank you for your reply. This approach does work, but it seems to deviate from my original intent. I was hoping to achieve this through workflow configurations rather than implementing a completely custom solution. I wonder if it might be possible to add processes that can be executed asynchronously within the workflow? This feature would be quite useful in scenarios where the execution needs to be hidden from the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 feat:workflow Workflow related stuff.
Projects
None yet
Development

No branches or pull requests

3 participants