Dify
As an open-source LLM application development platform, with its ability to develop applications from the Agent
Build, AI workflow
organize RAG
The all-encompassing capabilities of retrieval and model management have gained traction in the developer community. It is known for its elegant design and smooth experience, while the development team's amazing iterative speed keeps its features improving.
However, as the complexity of application scenarios increases, the Dify
A core limitation in workflow orchestration is becoming apparent: the platform does not currently support multiple Chatflow
orchestration and inter-calls between them. This means that all business logic must be integrated in a single Chatflow
canvas. As the logic becomes complex, this canvas will expand rapidly, leading to a dramatic decrease in maintainability.
(go ahead and do it) without hesitating Dify
Provides a way to combine Chatflow
convert Workflow
and published as a workaround for Tool nodes, but the approach suffers from two key flaws:
- Streaming output is not possible: Called as a tool node
Workflow
unsupportedChatflow
Native Streaming Output capability. This is at the expense of the user experience, especially in conversational applications that require immediate feedback. - Multiple output nodes are not supported::
Workflow
s single output limits its use in complex data processing and branching logic scenarios.
In order to break through these limitations, community developers have launched a program called Chatflow Invoker
plugin. It allows to convert any local or remote Chatflow
encapsulated as a separate node in the process, realizing cross Chatflow
This effectively enhances the modularity, flexibility, and maintainability of AI application development.
Chatflow Invoker
The core strength of the plugin is:
- realization
Chatflow
modularity: Complex business logic can be broken down into multiple independentChatflow
unit, significantly improving the reusability of the logic. - Supports cross
Chatflow
invocations: In differentChatflow
Data and instructions can be easily transferred between them, enabling more flexible business processes. - Maintaining the full streaming output experience: Even across
Chatflow
The native streaming output feature can still be retained in the calling scenario, which guarantees the end-user interaction experience.
Usage
Chatflow Invoker
Supports both local and remote calling modes , covering the different needs of single instance and distributed deployment .
Local Chatflow Calls
The local call applies to calls made in the same Dify
Instances internally have a different Chatflow
Make the choreography.
Input Parameters:
APP ID
(Required): ObjectiveChatflow
The ID can be retrieved from theDify
directly from the application's URL.Prompt
(Required): Send to targetChatflow
of the query or command.Inputs JSON
(optional): a JSON-formatted string to be passed to theChatflow
Input parameters for the start node.Conversation ID
(optional): the session ID used to maintain multiple rounds of dialog. if you need to continue the interaction based on the previous dialog history, you must provide theconversation_id
The
Operational Steps:
- localization target
Chatflow
(used form a nominal expression)APP ID
. For examplehttps://dify/app/f011f58c-b1ce-4a9b-89b2-f39fce8466a8/workflow
In this URL, thef011f58c-b1ce-4a9b-89b2-f39fce8466a8
just likeAPP ID
The - exist
Chatflow Invoker
Configuration in the nodeInputs JSON
parameter to define the variables to be received.
- In the reply node, make sure to select
stream_output
variable to receive and pass downstream the results of the streaming output.
- Execute the test and you can see that the plugin successfully calls another
Chatflow
, and returns the streaming output content in its entirety.
Remote Chatflow Calls
The remote call functionality is further extended with Dify
application boundaries, allowing users to build applications that span different Dify
Instances of distributed AI applications.
Input Parameters:
URL
(Required): RemoteDify
The message API address of the instance, for examplehttp://127.0.0.1:5001/v1/chat-messages
TheAPI Key
(Required): ObjectiveChatflow
The API access key for thePrompt
(Required): The query or command to send.User
(Required): A character string used to identify the end user for subsequent log retrieval and usage statistics.Inputs JSON
(optional): passes to theChatflow
Input parameters for the start node.Conversation ID
(Optional): The session ID used to maintain the status of a multi-round dialog.
Operational Steps:
- In the remote that needs to be called
Chatflow
The "Access API" menu in theAPI Key
The
- connect a remote
Dify
and the generated API address of theAPI Key
fill inChatflow Invoker
The corresponding field of the plugin.
- importation
Prompt
and execute, you can realize remote calls while maintaining streaming output.
An added benefit of remote calls over local calls is that all call logs are recorded in the called Dify
The instance leaves a full log for debugging and monitoring.
Development Description
Currently, for Dify
There is relatively little reference documentation for developing plugins, and AI models lack relevant training data. However.Dify
The official code repository provides a wealth of plugin samples and is a great resource for learning and development.
exist Chatflow Invoker
During the development of the app-selector
The component lets the user choose through an interface Chatflow
, but the component was flawed in the tool node scenario, which prevented the application from being selected. Therefore, the final approach was to manually fill in the APP ID
way as an alternative.
Chatflow Invoker
The plugin is now available in the Dify
The official plugin marketplace is online, so users can search and install it directly. The source code is also available on GitHub.
Source URL: https://github.com/yzddmr6/chatflow_invoker