Skip to content

Tool Response is empty in Agent node if response too long ( > 68000 ) #18731

Closed

Description

@EcoleKeine

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • 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.

Dify version

1.3.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. create tool workflow long_text_creator
    return code node result:
def main() -> dict:
    return {
        "result": "1234567890" * 6800,
    }
  1. create chatflow, add agent, make agent use long_text_creator tool
    add long_text_creator tool node for compare

✔️ Expected Behavior

LLM agent call long_text_creator tool and get long text

❌ Actual Behavior

Agent node function call result:

{
  "output": {
    "tool_call_id": "long_text_creator",
    "tool_call_input": {},
    "tool_call_name": "long_text_creator",
    "tool_response": ""
  }
}

Tool Node result is ok

Activity

  1. added
    🐞 bug
    on Apr 25, 2025
  2. dosubot commented on Apr 25, 2025

    @dosubot

    The issue you're experiencing with the Agent node not handling long tool responses correctly might be related to the maximum payload size settings in Dify. The Agent node raises a ResponseSizeError if the response size exceeds the defined threshold, which could be causing the empty response you're seeing [1].

    To address this, you can adjust the MAX_VARIABLE_SIZE setting in your docker/docker-compose.yaml file to handle larger responses. The default value is 204800, and increasing this value might help accommodate longer responses [2]. Additionally, check the HTTP_REQUEST_NODE_MAX_TEXT_SIZE setting, which defaults to 1MB, and increase it if necessary to ensure it can handle the size of your tool's response [3].

    Make sure to restart your Docker containers after making these changes to apply the new configuration.

    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

  3. crazywoola commented on Apr 25, 2025

    @crazywoola
    Member

    Have you changed these?

    dify/docker/.env.example

    Lines 739 to 752 in 37e2f73

    CODE_EXECUTION_ENDPOINT=http://sandbox:8194
    CODE_EXECUTION_API_KEY=dify-sandbox
    CODE_MAX_NUMBER=9223372036854775807
    CODE_MIN_NUMBER=-9223372036854775808
    CODE_MAX_DEPTH=5
    CODE_MAX_PRECISION=20
    CODE_MAX_STRING_LENGTH=80000
    CODE_MAX_STRING_ARRAY_LENGTH=30
    CODE_MAX_OBJECT_ARRAY_LENGTH=30
    CODE_MAX_NUMBER_ARRAY_LENGTH=1000
    CODE_EXECUTION_CONNECT_TIMEOUT=10
    CODE_EXECUTION_READ_TIMEOUT=60
    CODE_EXECUTION_WRITE_TIMEOUT=10
    TEMPLATE_TRANSFORM_MAX_LENGTH=80000

  4. EcoleKeine commented on Apr 25, 2025

    @EcoleKeine
    Author

    @crazywoola

    those are changed:
    CODE_MAX_STRING_ARRAY_LENGTH=300
    CODE_MAX_OBJECT_ARRAY_LENGTH=300
    CODE_EXECUTION_READ_TIMEOUT=360

    my .env:

    # The sandbox service endpoint.
    CODE_EXECUTION_ENDPOINT=http://sandbox:8194
    CODE_EXECUTION_API_KEY=dify-sandbox
    CODE_MAX_NUMBER=9223372036854775807
    CODE_MIN_NUMBER=-9223372036854775808
    CODE_MAX_DEPTH=5
    CODE_MAX_PRECISION=20
    CODE_MAX_STRING_LENGTH=80000
    CODE_MAX_STRING_ARRAY_LENGTH=300
    CODE_MAX_OBJECT_ARRAY_LENGTH=300
    CODE_MAX_NUMBER_ARRAY_LENGTH=1000
    CODE_EXECUTION_CONNECT_TIMEOUT=10
    CODE_EXECUTION_READ_TIMEOUT=360
    CODE_EXECUTION_WRITE_TIMEOUT=10
    TEMPLATE_TRANSFORM_MAX_LENGTH=80000
  5. crazywoola commented on Apr 25, 2025

    @crazywoola
    Member
    Image

    I have tried, it seems working as expected.

  6. crazywoola commented on Apr 25, 2025

    @crazywoola
    Member

    If the LLM still generates the results, then it means the connection with plugin_daemon is normal. Maybe it's a frontend limitation.

    https://github.com/langgenius/dify/blob/44cdb3dceaf6414d3ca3e5fd864fed4ed1e335fa/web/service/base.ts

  7. EcoleKeine commented on Apr 25, 2025

    @EcoleKeine
    Author

    @crazywoola

    I have tried, it seems working as expected.

    Only call by Agent Node will return empty
    Tool Node working as expected

  8. self-assigned this
    on Apr 27, 2025
  9. Nov1c444 commented on Apr 28, 2025

    @Nov1c444
    Contributor

    After my investigation, I found that the reason the tool results cannot be returned here is because the default size of the scanner in Go is 64k. When exceeding this size, it will skip the content. We can support larger response by increasing this limit, but we're still discussing exactly how large the adjustment should be.

    Image

  10. Nov1c444 commented on May 13, 2025

    @Nov1c444
    Contributor

    Now you can increase the byte transmission limit by configuring the two env parameters PLUGIN_STDIO_BUFFER_SIZE and PLUGIN_STDIO_MAX_BUFFER_SIZE in the dify-plugin-daemon service.

    Image
  11. homeant commented on May 21, 2025

    @homeant
    Contributor

    Has anyone resolved this issue? I’d really appreciate some guidance.

  12. zhudongwork commented on Jul 2, 2025

    @zhudongwork
    Contributor

    But when the input is long(~60k), the agent node returns an empty output after running for a few seconds. Is there a timeout setting causing this? With the same input, the LLM node can start generating output after waiting around 10 seconds.

    Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🐞 bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions