run agents in workflow show error
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.0.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
when I run workflow with agents, it shows below error:
Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"ValidationError","message":"1 validation error for FunctionCallingParams\nmodel.entity\n Input should be a valid dictionary or instance of AIModelEntity [type=model_type, input_value=None, input_type=NoneType]\n For further information visit https://errors.pydantic.dev/2.8/v/model_type"}
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
Hello, @yulin12341! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you're facing.
I found a similar unsolved discussion that might be relevant to your issue: Agent node in workflow run status fails, which was last updated on February 28, 2025 [1].
Regarding the error you're encountering, it seems to be related to a ValidationError in the FunctionCallingParams. This error typically occurs when the input is not a valid dictionary or instance of AIModelEntity. To resolve this, ensure that the model parameter in your workflow configuration is correctly defined as a valid AIModelEntity. This includes specifying the model identifier and ensuring that all required fields are correctly populated [2].
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
My configuration is very simple, but can't run the agents in workflow, please help to check the below configuration:
The error you're encountering is related to the FunctionCallingParams\model.entity field, which needs to be a valid dictionary or an instance of AIModelEntity. Here are a few steps to help resolve this issue:
-
Ensure Correct Model Configuration: Verify that the
modelfield in your configuration is correctly defined as an instance ofAIModelEntity. This includes specifying the model identifier, such as "doubao-pro-128k", and ensuring all required fields are populated correctly. The required fields for anAIModelEntityincludemodel,model_type, andmodel_properties[1]. -
Check the
FunctionCallingParams: Make sure that themodelparameter in theFunctionCallingParamsis defined using theAgentModelConfigclass. This ensures that the model parameter is correctly configured to avoid validation errors [2]. -
Review the Tool List: Ensure that the tools listed, such as the "TIME" calculator, are compatible with the selected model and correctly configured. Although specific details about the "doubao-pro-128k" model and the "TIME" calculator tool are not available, ensuring compatibility and correct configuration is crucial.
-
Validate the YAML Configuration: If you're using a
function_calling.yamlfile, double-check the syntax and ensure all parameters are correctly defined, includingmodel,tools,query, andmax_iterations.
By following these steps, you should be able to resolve the validation error and successfully run the agents in your workflow.
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
below is my configuration, it's very simple! should not be wrong with the configuration.
app: description: '' icon: 🤖 icon_background: '#FFEAD5' mode: advanced-chat name: 测试chatflow use_icon_as_answer_icon: false dependencies: [] kind: app version: 0.1.5 workflow: conversation_variables: [] environment_variables: [] features: file_upload: allowed_file_extensions: - .JPG - .JPEG - .PNG - .GIF - .WEBP - .SVG allowed_file_types: - image allowed_file_upload_methods: - local_file - remote_url enabled: false fileUploadConfig: audio_file_size_limit: 50 batch_count_limit: 5 file_size_limit: 15 image_file_size_limit: 10 video_file_size_limit: 100 workflow_file_upload_limit: 10 image: enabled: false number_limits: 3 transfer_methods: - local_file - remote_url number_limits: 3 opening_statement: '' retriever_resource: enabled: true sensitive_word_avoidance: enabled: false speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false language: '' voice: '' graph: edges: - data: isInIteration: false sourceType: start targetType: agent id: 1740845799739-source-1740926418820-target source: '1740845799739' sourceHandle: source target: '1740926418820' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: agent targetType: answer id: 1740926418820-source-answer-target source: '1740926418820' sourceHandle: source target: answer targetHandle: target type: custom zIndex: 0 nodes: - data: desc: '' selected: false title: 开始 type: start variables: [] height: 54 id: '1740845799739' position: x: 78.94444628236204 y: 282 positionAbsolute: x: 78.94444628236204 y: 282 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: answer: '{{#llm.text#}}' desc: '' selected: false title: 直接回复 type: answer variables: [] height: 103 id: answer position: x: 775.2667318004308 y: 176.67212346540285 positionAbsolute: x: 775.2667318004308 y: 176.67212346540285 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: agent_parameters: instruction: type: constant value: you are a risk manager. model: type: constant value: completion_params: {} mode: chat model: doubao-pro-128k model_type: llm provider: langgenius/volcengine_maas/volcengine_maas type: model-selector query: type: constant value: '{{#sys.query#}}' tools: type: constant value: - enabled: true extra: description: '' parameters: day: auto: 1 value: null month: auto: 1 value: null year: auto: 1 value: null provider_name: time schemas: - auto_generate: null default: null form: llm human_description: en_US: Year ja_JP: Year pt_BR: Year zh_Hans: 年 label: en_US: Year ja_JP: Year pt_BR: Year zh_Hans: 年 llm_description: null max: null min: null name: year options: [] placeholder: null precision: null required: true scope: null template: null type: number - auto_generate: null default: null form: llm human_description: en_US: Month ja_JP: Month pt_BR: Month zh_Hans: 月 label: en_US: Month ja_JP: Month pt_BR: Month zh_Hans: 月 llm_description: null max: null min: null name: month options: [] placeholder: null precision: null required: true scope: null template: null type: number - auto_generate: null default: null form: llm human_description: en_US: day ja_JP: day pt_BR: day zh_Hans: 日 label: en_US: day ja_JP: day pt_BR: day zh_Hans: 日 llm_description: null max: null min: null name: day options: [] placeholder: null precision: null required: true scope: null template: null type: number settings: {} tool_label: 星期几计算器 tool_name: weekday type: builtin agent_strategy_label: FunctionCalling agent_strategy_name: function_calling agent_strategy_provider_name: langgenius/agent/agent desc: '' output_schema: null plugin_unique_identifier: langgenius/agent:0.0.8@6dd1206901fa166f1a631fb3f0f8eb08f9e7cf54043b7fe45fcb011218cad7a2 selected: false title: Agent type: agent height: 198 id: '1740926418820' position: x: 467.23918844161807 y: 369.6523832785868 positionAbsolute: x: 467.23918844161807 y: 369.6523832785868 selected: true sourcePosition: right targetPosition: left type: custom width: 244 viewport: x: 114.77436976154002 y: -47.14612545816931 zoom: 0.9253044280378528
I got error with function calling agent: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"ValidationError","message":"1 validation error for LogMessage\nmetadata.start_at.[key]\n Input should be 'started_at', 'finished_at', 'elapsed_time', 'total_price', 'total_tokens', 'provider' or 'currency' [type=enum, input_value='start_at', input_type=str]\n For further information visit https://errors.pydantic.dev/2.8/v/enum"}
@dosu
The error you're encountering is related to the model.entity field in the FunctionCallingParams, which needs to be a valid dictionary or an instance of AIModelEntity. Here are some steps to help resolve this issue:
-
Verify Model Configuration: Ensure that the
modelfield in your configuration is correctly defined as an instance ofAIModelEntity. This includes specifying the model identifier, such as "doubao-pro-128k", and ensuring all required fields are populated correctly. The required fields for anAIModelEntityincludemodel,model_type, andmodel_properties[1]. -
Check
FunctionCallingParamsStructure: Make sure that themodelparameter in theFunctionCallingParamsis defined using theAgentModelConfigclass. This ensures that the model parameter is correctly configured to avoid validation errors [2]. -
Review the Configuration: Double-check the configuration to ensure that all parameters are correctly defined, including
model,tools,query, andmax_iterations. Ensure that themodelfield is not missing any required attributes.
By following these steps, you should be able to resolve the validation error and successfully run the agents in your workflow.
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
@dosu Hello, I'm a bit confused. I used the interface for configuration. Where exactly do I configure this AIModelEntity information?
To configure the AIModelEntity information in Dify, you need to go to Settings --> Model Providers in the Dify interface. Here, you can add and configure the language model you intend to use. Make sure to specify the model identifier, model type, and model properties correctly. This setup is crucial for ensuring that the model parameter in your workflow is correctly defined as an instance of AIModelEntity [1].
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
@dosu Hello, please take a look at the two screenshots I've attached. The first one is the model configuration, which I configured using Volcengine. I am certain that the configuration information is correct. Additionally, as you can see from my second screenshot, there are no issues when calling within a single agent, indicating that the model configuration is correct. Moreover, the doubao model I'm using does support function calls.
The issue you're facing with the FunctionCallingParams\model.entity validation error might be due to a mismatch in how the model is configured in the workflow compared to the single agent setup. Here are a few things to check:
-
Model Configuration Consistency: Ensure that the model configuration in the workflow matches exactly with the configuration used in the single agent setup. This includes verifying that all fields such as
model,model_type, andproviderare identical. -
Required Parameters: Double-check that all required parameters for the
doubao-pro-128kmodel are provided in the workflow configuration. Missing parameters can lead to validation errors [1]. -
Tool Configuration: Ensure that the tools used in the workflow are correctly enabled and configured. The validation error can occur if the tools are not properly set up or if required tools are missing [1].
-
FunctionCallingParams Validation: Make sure that the
FunctionCallingParamsare correctly defined, including themodel,tools, andqueryfields. Themodelfield should be a valid instance ofAIModelEntity, and all necessary attributes should be populated [2].
By ensuring these configurations are consistent and complete, you should be able to resolve the validation error in the workflow.
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
@dosu please help to look at the screenshot I've attached. The agent information I configured in the workflow is as shown in the screenshot, and it's just a very simple test workflow. The model configured inside the agent is the one I defined, consistent with the model configuration. The tool simply calls the 'weekday' built-in tool, which seems to be one of the simplest workflows with an agent that could be defined for use. However, it keeps showing an error.
The error you're encountering might be due to a few potential issues in the configuration of the AIModelEntity or the FunctionCallingParams. Here are some steps to help resolve this:
-
Verify Model Configuration: Ensure that the model configuration in the workflow is consistent with the single agent setup. This includes checking that the
model,model_type, andproviderfields are correctly defined and match the configuration used in the single agent setup. -
Check Required Fields: Make sure all required fields for the
AIModelEntityare correctly populated. This includes fields likemodel,model_type, andmodel_properties. Themodel_propertiesshould include necessary attributes likemodeand any other specific properties required by the model type [1]. -
Tool Configuration: Since you're using the 'weekday' built-in tool, ensure that all required parameters (
year,month,day) are correctly set up in the workflow. These parameters should be provided in the correct format and should not be null [2]. -
FunctionCallingParams Validation: Double-check the
FunctionCallingParamsto ensure that themodelfield is a valid instance ofAIModelEntityand that all necessary attributes are included. This includes ensuring that themodelparameter is correctly defined using theAgentModelConfigclass [3].
By ensuring these configurations are consistent and complete, you should be able to resolve the validation error in the workflow.
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
换模型就好了,用deepseek模型可以不报错
@Bestwo2024 为啥换模型就好了,其它模型不能支持么?
@Bestwo2024 为啥换模型就好了,其它模型不能支持么?
I can not understand, either. What i've tried for the agent node specified FunctionCalling:
| Provider | Model | Result |
|---|---|---|
| OpenRouter | All those free tier models, especially DeepSeek | |
| Cohere | Command/R Series | |
| Cohere | Same, but assign the agent with 2 tools | |
| SiliconFlows | None, due to bugs | I can not find those models configured when trying to specify for FunctionCalling actually. Maybe all the models has been marked as "Unsupported for FunctionCalling" in SiliconFlows. |
There is quite some weird problems inside FunctionCalling. Or else, just show us What the provider and model is supposed to be supporting FuncionCalling in a list.
NOTE: All of these happened when using Dify Cloud which might be with Network Issues when accessing from China.
After debugging, it was determined that the error requires modifying the dependency code within the plugin.
Modify the __init__.py file in the directory volumes/plugin_daemon/cwd/langgenius/agent-0.0.9@f16916b704a20067317dbe9030f62aa28f0832021a3ef6d4ce699504074c5e13/.venv/lib64/python3.12/site-packages/dify_plugin/interfaces/agent, and set the default value of entity in the AgentModelConfig class to None.
Before modification:
class AgentModelConfig(LLMModelConfig):
entity: AIModelEntity
After modification:
class AgentModelConfig(LLMModelConfig):
entity: Optional[AIModelEntity] = Field(default=None)
To restart the docker-plugin_daemon-1 container after modifying the code, you can use the following command:
docker restart docker-plugin_daemon-1
Verification result:
Hi, @yulin12341. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.
Issue Summary
- You reported a
PluginInvokeErrordue to aValidationErrorinFunctionCallingParams. - The error was related to the
model.entityfield not being a valid dictionary orAIModelEntity. - User HamaWhiteGG suggested modifying the
AgentModelConfigclass to set theentityfield's default toNone. - The issue was resolved by implementing this change and restarting the Docker container.
Next Steps
- Please confirm if this issue is still relevant to the latest version of Dify.
- If not updated, this issue will be automatically closed in 15 days.
Thank you for your understanding and contribution!
@dosu - This is still an issue, it is not stale. This is after testing an Agent in a basic chatflow
@dosu - This is still an issue, it is not stale. This is after testing an Agent in a basic chatflow
Could you please provider your agent plugin's version? Maybe update the plugin's version could solve the issues
The issue with certain models not supporting FunctionCalling in Dify can be attributed to specific requirements and compatibility issues. Here are some key points to consider:
-
Model Requirements: For a model to support FunctionCalling in Dify, it must have Vision multimodal support and the Function Call parameter enabled. Additionally, compatibility with the Agent plugin is necessary, as not all models that work in workflows are supported in Agent nodes [1][2].
-
Known Model Issues: Some models, like those from PPIO, currently do not support Function Call as Agent Mode due to the lack of Function Calling capability in their API. This feature is under development [3]. Additionally, using models like gpt-4o-mini may result in inconsistent function call outputs due to the model's decision-making behavior [4].
-
Provider and Model Compatibility: If you encounter issues with specific models, consider switching to models from different providers that are known to be compatible with FunctionCalling. For example, using the DeepSeek model resolved the issue for another user [3].
-
Configuration Adjustments: If you are experiencing validation errors related to
AIModelEntity, ensure that the model configuration is correctly defined with all required fields populated. You may also need to modify theAgentModelConfigclass to set theentityattribute toNoneby default, as suggested in previous debugging steps [5][6].
By ensuring that the models meet these requirements and making necessary configuration adjustments, you should be able to resolve the issues with FunctionCalling in Dify.
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
Could you please provider your agent plugin's version? Maybe update the plugin's version could solve the issues
@Nov1c444 - We're using GPT-4o on Azure OpenAI, v0.0.14, which is the latest.
It appears that upgrading to v1.2.0 resolves the issue.
Could you please provider your agent plugin's version? Maybe update the plugin's version could solve the issues
@Nov1c444 - We're using GPT-4o on Azure OpenAI, v0.0.14, which is the latest.
You could upgrade the agent plugin's version, the latest version is 0.0.14.
Could you please provider your agent plugin's version? Maybe update the plugin's version could solve the issues
@Nov1c444 - We're using GPT-4o on Azure OpenAI, v0.0.14, which is the latest.
You could upgrade the agent plugin's version, the latest version is 0.0.14.
Thanks. Did this as well, but can't say whether it resolved the issue. I'd already found a fix. See higher up in the chain.
You could upgrade the agent plugin's version, the latest version is 0.0.14.