How to publish a Q&A assistant workflow as a sub-workflow to facilitate calling by other workflows #7130

Closed
opened 2026-02-21 18:19:03 -05:00 by yindo · 2 comments
Owner

Originally created by @zlei0251 on GitHub (Dec 10, 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.

How to publish a Q&A assistant workflow as a sub-workflow to facilitate calling by other workflows

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @zlei0251 on GitHub (Dec 10, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] 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. How to publish a Q&A assistant workflow as a sub-workflow to facilitate calling by other workflows ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 🌊 feat:workflow label 2026-02-21 18:19:03 -05:00
yindo closed this issue 2026-02-21 18:19:03 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 10, 2024):

To publish a Q&A assistant workflow as a sub-workflow for use by other workflows, you can utilize the PublishedWorkflowApi class. This class provides a method to publish a workflow, making it accessible to other workflows.

Here's a brief overview of the process:

  1. Ensure User Role: The user must have a role of admin, owner, or editor to publish a workflow.

  2. API Endpoint: Make a POST request to the endpoint /apps/<uuid:app_id>/workflows/publish with the appropriate app model.

  3. Code Implementation: The post method in the PublishedWorkflowApi class handles the publishing. It checks the user's role and uses the WorkflowService to publish the workflow.

Here's a code snippet for reference:

class PublishedWorkflowApi(Resource):
    @setup_required
    @login_required
    @account_initialization_required
    @get_app_model(mode=[AppMode.ADVANCED_CHAT, AppMode.WORKFLOW])
    def post(self, app_model: App):
        if not current_user.is_editor:
            raise Forbidden()

        workflow_service = WorkflowService()
        workflow = workflow_service.publish_workflow(app_model=app_model, account=current_user)

        return {"result": "success", "created_at": TimestampField().format(workflow.created_at)}

This method ensures that the workflow is published and can be called by other workflows [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Dec 10, 2024): <!-- Answer --> To publish a Q&A assistant workflow as a sub-workflow for use by other workflows, you can utilize the `PublishedWorkflowApi` class. This class provides a method to publish a workflow, making it accessible to other workflows. Here's a brief overview of the process: 1. **Ensure User Role**: The user must have a role of admin, owner, or editor to publish a workflow. 2. **API Endpoint**: Make a POST request to the endpoint `/apps/<uuid:app_id>/workflows/publish` with the appropriate app model. 3. **Code Implementation**: The `post` method in the `PublishedWorkflowApi` class handles the publishing. It checks the user's role and uses the `WorkflowService` to publish the workflow. Here's a code snippet for reference: ```python class PublishedWorkflowApi(Resource): @setup_required @login_required @account_initialization_required @get_app_model(mode=[AppMode.ADVANCED_CHAT, AppMode.WORKFLOW]) def post(self, app_model: App): if not current_user.is_editor: raise Forbidden() workflow_service = WorkflowService() workflow = workflow_service.publish_workflow(app_model=app_model, account=current_user) return {"result": "success", "created_at": TimestampField().format(workflow.created_at)} ``` This method ensures that the workflow is published and can be called by other workflows <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/controllers/console/app/workflow.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/3f1aa210-f8c2-43ba-b840-95a96f90469d?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/3f1aa210-f8c2-43ba-b840-95a96f90469d?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/3f1aa210-f8c2-43ba-b840-95a96f90469d?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/3f1aa210-f8c2-43ba-b840-95a96f90469d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3f1aa210-f8c2-43ba-b840-95a96f90469d?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/3f1aa210-f8c2-43ba-b840-95a96f90469d?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Dec 10, 2024):

For questions, please use discusston instead.

@crazywoola commented on GitHub (Dec 10, 2024): For questions, please use discusston instead.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7130