What is the difference between CotAgentRunner and FunctionCallAgentRunner, and in what scenarios are they used? #5282

Closed
opened 2026-02-21 18:10:15 -05:00 by yindo · 1 comment
Owner

Originally created by @lopman87 on GitHub (Aug 28, 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 report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Provide a description of requested docs changes

What is the difference between CotAgentRunner and FunctionCallAgentRunner, and in what scenarios are they used?

Originally created by @lopman87 on GitHub (Aug 28, 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 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. ### Provide a description of requested docs changes What is the difference between CotAgentRunner and FunctionCallAgentRunner, and in what scenarios are they used?
yindo added the 📚 documentation label 2026-02-21 18:10:15 -05:00
yindo closed this issue 2026-02-21 18:10:15 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 28, 2024):

The CotAgentRunner and FunctionCallAgentRunner are both classes used in different scenarios within the Dify platform. Here are the differences and their respective use cases:

CotAgentRunner

  • Purpose: Designed to run a Chain-of-Thought (CoT) agent application.
  • Functionality: Involves multiple iterations where the agent generates thoughts, actions, and observations. The agent can invoke tools and handle their responses, iterating until a final answer is reached or a maximum number of iterations is exceeded.
  • Use Case: Used when the agent needs to perform complex reasoning tasks that involve multiple steps, tool invocations, and iterative processing to arrive at a final answer.

FunctionCallAgentRunner

  • Purpose: Designed to handle function calls directly.
  • Functionality: Focuses on invoking functions and handling their responses without the iterative thought-action-observation process seen in CotAgentRunner.
  • Use Case: Used when the agent's task is straightforward and can be accomplished by directly calling a function and processing its result.

In summary, CotAgentRunner is used for complex, multi-step reasoning tasks, while FunctionCallAgentRunner is used for direct function invocation tasks. The AgentChatAppRunner class in Dify determines which runner to use based on the agent's strategy, either CHAIN_OF_THOUGHT or FUNCTION_CALLING [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 28, 2024): <!-- Answer --> The `CotAgentRunner` and `FunctionCallAgentRunner` are both classes used in different scenarios within the Dify platform. Here are the differences and their respective use cases: ### CotAgentRunner - **Purpose**: Designed to run a Chain-of-Thought (CoT) agent application. - **Functionality**: Involves multiple iterations where the agent generates thoughts, actions, and observations. The agent can invoke tools and handle their responses, iterating until a final answer is reached or a maximum number of iterations is exceeded. - **Use Case**: Used when the agent needs to perform complex reasoning tasks that involve multiple steps, tool invocations, and iterative processing to arrive at a final answer. ### FunctionCallAgentRunner - **Purpose**: Designed to handle function calls directly. - **Functionality**: Focuses on invoking functions and handling their responses without the iterative thought-action-observation process seen in `CotAgentRunner`. - **Use Case**: Used when the agent's task is straightforward and can be accomplished by directly calling a function and processing its result. In summary, `CotAgentRunner` is used for complex, multi-step reasoning tasks, while `FunctionCallAgentRunner` is used for direct function invocation tasks. The `AgentChatAppRunner` class in Dify determines which runner to use based on the agent's strategy, either `CHAIN_OF_THOUGHT` or `FUNCTION_CALLING` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/agent/cot_agent_runner.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/app/apps/agent_chat/app_runner.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5282