In a workflow published as a tool, the output variables defined in the end block are not returned to the caller
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.4.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
We have implemented a process to call a workflow that has been published as a tool from a chatflow.
・chatflow
・Workflow published as a tool
In the workflow, the knowledge search block is set up to retrieve all text filled with the letter "a" (approximately 100,000 characters).
I would like to return the 100,000 characters retrieved by the knowledge search to the chat flow that called it, but they are not being returned.
The fact that the item was not returned is confirmed by looking at the log.
✔️ Expected Behavior
100,000 characters of "a" are returned (the returned content is stored in tool_response)
※If it is 50,000 characters instead of 100,000 characters, it will be stored in tool_response and it will be confirmed that it has been returned.
❌ Actual Behavior
tool_response is blank
Hello @kanno2811! I'm Dosu, your friendly bot here to help you solve bugs, answer questions, and guide you on your journey to becoming a contributor. I'm here while you wait for a human maintainer, so let's tackle this issue together!
It seems like the issue you're experiencing is related to the maximum character limit for tool responses in Dify. The maximum character limit for tool responses is 68,000 characters. If your response exceeds this limit, it may not be returned correctly, which aligns with the behavior you're observing when trying to return 100,000 characters [1].
To handle large data outputs, you can adjust specific configurations in the docker/.env file. For outputs exceeding 68,000 characters, you can set the following parameters:
CODE_MAX_STRING_LENGTH=80000
CODE_MAX_STRING_ARRAY_LENGTH=300
CODE_MAX_OBJECT_ARRAY_LENGTH=300
CODE_EXECUTION_READ_TIMEOUT=360
TEMPLATE_TRANSFORM_MAX_LENGTH=80000
After updating these settings, restart your Docker containers to apply the changes [1][2]. This should help in managing larger outputs effectively.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
・.env I modified the .env file, but it didn't improve.
・docker-compose.yaml
Also, even after fixing PLUGIN_STDIO_BUFFER_SIZE and PLUGIN_STDIO_MAX_BUFFER_SIZE, there was no improvement.
I have a similar problem. While in my case, tool_response is OK but llm_response is empty ("llm_response": ""). Similar thing is that this also only happens when the tool_response is long.
My local debugging confirmed that the raw LLM response, i.e., response from openai api after giving tool_response, does have meaningful content.
Wired. Have debugged for three days. Still not solved.
PLUGIN_STDIO_MAX_BUFFER_SIZE not works for me.
Hi, @kanno2811. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.
Issue Summary:
- You reported that in Dify v1.4.0 self-hosted via Docker, large output variables (~100,000 characters) from a workflow tool are not returned to the calling chatflow, resulting in empty
tool_response. - Smaller outputs work fine, but increasing limits like
CODE_MAX_STRING_LENGTHandPLUGIN_STDIO_BUFFER_SIZEin.envanddocker-compose.yamldid not resolve the issue. - Another user shared a similar problem where long
tool_responsecauses emptyllm_responsedespite the raw LLM response being correct. - The issue seems related to internal buffer or character limits when handling large outputs, but current configuration changes have not fixed it.
Next Steps:
- Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
- Otherwise, I will automatically close this issue in 15 days.
Thank you for your understanding and contribution!