How to modify the runtime of a custom tool in workflow #7045

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

Originally created by @RXZD on GitHub (Dec 4, 2024).

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

0.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

sry, it's still the same issue I raised before. Since the previous question has been closed, I'm submitting a new one.

Here is my previous attempt:
The modification of TEXT_GENERATION_TIMEOUT_MS seems to be ineffective. I have set TEXT_GENERATION_TIMEOUT_MS=3600000, but when using the custom tool in the workflow, I encounter an error at the 15-minute mark: "Failed to invoke tool: Reached maximum retries (0) for URL." Here, I have already changed SSRF_DEFAULT_MAX_RETRIES=0.

✔️ Expected Behavior

I would like to be able to modify the runtime of the custom tool in the workflow. As stated in the issue, change the 15-minute limit for the custom tool in the workflow to 60 minutes.

Actual Behavior

No response

Originally created by @RXZD on GitHub (Dec 4, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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. ### Dify version 0.9.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce sry, it's still the same issue I raised before. Since the previous question has been closed, I'm submitting a new one. Here is my previous attempt: The modification of TEXT_GENERATION_TIMEOUT_MS seems to be ineffective. I have set TEXT_GENERATION_TIMEOUT_MS=3600000, but when using the custom tool in the workflow, I encounter an error at the 15-minute mark: "Failed to invoke tool: Reached maximum retries (0) for URL." Here, I have already changed SSRF_DEFAULT_MAX_RETRIES=0. ### ✔️ Expected Behavior I would like to be able to modify the runtime of the custom tool in the workflow. As stated in the issue, change the 15-minute limit for the custom tool in the workflow to 60 minutes. ### ❌ Actual Behavior _No response_
yindo added the 🔨 feat:tools🌊 feat:workflow labels 2026-02-21 18:18:35 -05:00
yindo closed this issue 2026-02-21 18:18:35 -05:00
Author
Owner

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

To modify the runtime of a custom tool in a Dify workflow, you can adjust the timeout settings using environment variables. Specifically, you should look into the API_TOOL_DEFAULT_CONNECT_TIMEOUT and API_TOOL_DEFAULT_READ_TIMEOUT environment variables, which control the connection and read timeouts for API tools. By default, these are set to 10 seconds and 60 seconds, respectively, but you can increase them to suit your needs.

Here's how you can configure these settings:

  1. Open your .env file in the docker directory of your Dify source code.

  2. Add or modify the following environment variables to increase the timeout:

    API_TOOL_DEFAULT_CONNECT_TIMEOUT=600
    API_TOOL_DEFAULT_READ_TIMEOUT=3600
    

    This sets the connection timeout to 10 minutes and the read timeout to 60 minutes.

  3. Save the changes to your .env file.

  4. Restart your Dify instance to apply the changes:

    docker compose down
    docker compose up -d
    

These changes should help extend the runtime of your custom tool in the workflow. If you continue to encounter issues, ensure that other related settings, such as TEXT_GENERATION_TIMEOUT_MS, are also configured correctly and that there are no other constraints in your workflow logic or external services that might be causing the timeout [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Dec 4, 2024): <!-- Answer --> To modify the runtime of a custom tool in a Dify workflow, you can adjust the timeout settings using environment variables. Specifically, you should look into the `API_TOOL_DEFAULT_CONNECT_TIMEOUT` and `API_TOOL_DEFAULT_READ_TIMEOUT` environment variables, which control the connection and read timeouts for API tools. By default, these are set to 10 seconds and 60 seconds, respectively, but you can increase them to suit your needs. Here's how you can configure these settings: 1. Open your `.env` file in the `docker` directory of your Dify source code. 2. Add or modify the following environment variables to increase the timeout: ```plaintext API_TOOL_DEFAULT_CONNECT_TIMEOUT=600 API_TOOL_DEFAULT_READ_TIMEOUT=3600 ``` This sets the connection timeout to 10 minutes and the read timeout to 60 minutes. 3. Save the changes to your `.env` file. 4. Restart your Dify instance to apply the changes: ```bash docker compose down docker compose up -d ``` These changes should help extend the runtime of your custom tool in the workflow. If you continue to encounter issues, ensure that other related settings, such as `TEXT_GENERATION_TIMEOUT_MS`, are also configured correctly and that there are no other constraints in your workflow logic or external services that might be causing the timeout <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/tools/tool/api_tool.py)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/docker-compose.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

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

Should be one of those

https://github.com/langgenius/dify/blob/1d8385f7ac8d71f21650ea22be720fe3f14db84c/docker/.env.example#L695-L715

For questions, please use discussion instead. This template is only for bug report.

@crazywoola commented on GitHub (Dec 4, 2024): Should be one of those https://github.com/langgenius/dify/blob/1d8385f7ac8d71f21650ea22be720fe3f14db84c/docker/.env.example#L695-L715 For questions, please use discussion instead. This template is only for bug report.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7045