Plugin Daemon Model Parameter Handling#
When an Agent node invokes a model, it must send a valid completion_params (model parameter) payload to the plugin daemon. A structural divergence between how the workflow Agent node and the standalone Agent app build this payload was the root cause of InvokeError: [models] Error: 'required' failures reported in issue #39274.
The Bug: Empty completion_params in Workflow Agent Nodes#
The workflow frontend's model-selector widget only persists provider, model, and mode β it does not store completion_params. When the plugin SDK's AgentModelConfig receives a value without completion_params, it defaults the field to {}.
Agent Strategy plugins (cot_agent, function_calling) use completion_params to construct the LLMModelConfig passed back to the plugin daemon for the actual LLM call. Some model providers (e.g. Tongyi Qwen, any provider with parameter_rules that declare required fields) call _validate_and_filter_model_parameters, which raises KeyError('required') when the parameters dict is empty.
The standalone Agent app does not hit this path because it populates model settings from agent_soul.model.model_settings, which are then sanitized and forwarded through _agent_model_settings(). Known parameters (temperature, top_p, presence_penalty, frequency_penalty, max_tokens, stop_sequences) are passed directly, and any additional plugin-specific parameters are forwarded via extra_body.
The Fix: Populate Defaults from Model Schema#
PR #39590 (merged 2026-07-28) fixed this in AgentRuntimeSupport.build_parameters(). When the model-selector value lacks completion_params, it now populates it from the selected model's schema defaults:
- If a
model_schema(AIModelEntity) is available: calls_extract_default_completion_params(model_schema)which iteratesmodel_schema.parameter_rulesand collects every rule'sdefaultvalue wheredefault is not None. - If no schema is available: falls back to
{}.
A prior attempt (PR #39373) tried renaming completion_params to model_parameters in build_parameters(), but this was the wrong field name β AgentModelConfig expects completion_params β so the parameters were dropped instead of forwarded.
AgentSoulModelSettings: Persistence of Plugin Parameters#
The AgentSoulModelSettings model (defined in api/models/agent_config_entities.py) validates and stores model parameters for Agent Soul configurations. It now uses extra="allow" (via AgentFlexibleConfig inheritance) instead of the previous extra="ignore", meaning plugin-declared parameters (such as Qwen's enable_thinking or Tongyi-specific settings) are preserved during validation and persist through save/publish round trips, rather than being silently dropped.
This change ensures that parameters declared by model plugins via parameter_rules survive the configuration lifecycle. Combined with the _agent_model_settings() forwarding mechanism, plugin-specific parameters can now flow from the UI through persistence into runtime execution.
Parameter Flow by Path#
| Path | File | completion_params source |
|---|---|---|
| Workflow V1 Agent node | api/core/workflow/nodes/agent/runtime_support.py | Extracted from model_schema.parameter_rules defaults by _extract_default_completion_params() (post-fix) |
| Workflow V2 Agent node | api/core/workflow/nodes/agent_v2/runtime_request_builder.py | agent_soul.model.model_settings β forwarded through _agent_model_settings() whitelist |
| Standalone Agent app | api/core/app/apps/agent_app/runtime_request_builder.py | agent_soul.model.model_settings β same whitelist path |
For Agent V2 and the standalone app, the model_settings dict passes through _agent_model_settings() in api/clients/agent_backend/request_builder.py, which explicitly forwards temperature, top_p, presence_penalty, frequency_penalty, max_tokens, and stop_sequences. Additionally, any unknown parameters (such as plugin-specific ones like Qwen's enable_thinking) are preserved and forwarded via the extra_body dictionary, ensuring plugin-declared model parameters reach the backend.
Legacy V1 Agent nodes use AgentNodeData and the build_parameters() path. The MODEL_SELECTOR parameter type is the trigger point where completion_params extraction occurs.
Key Source Files#
| File | Role |
|---|---|
api/core/workflow/nodes/agent/runtime_support.py | AgentRuntimeSupport.build_parameters() β MODEL_SELECTOR completion_params population (patch target for #39590) |
api/core/workflow/nodes/agent_v2/runtime_request_builder.py | WorkflowAgentRuntimeRequestBuilder.build() β Agent V2 model config assembly |
api/core/app/apps/agent_app/runtime_request_builder.py | Standalone Agent App model config path β uses model_settings whitelist instead |
api/clients/agent_backend/request_builder.py | _agent_model_settings() β forwards known model settings directly and unknown parameters via extra_body |
api/core/workflow/nodes/agent/entities.py | AgentNodeData β V1 agent node data model including agent_parameters |
| Issue #39274 | Bug report: InvokeError: [models] Error: 'required' on Chatflow Agent nodes |
| PR #39590 | Merged fix: populate completion_params from model schema defaults |
Debugging Tips#
- The
'required'string comes from the plugin daemon's_validate_and_filter_model_parameters, which performs JSON schema validation against the model provider'sparameter_rules. Checkdocker compose logs plugin_daemon --tail 100for the full stack trace. - The error manifests in Chatflow/workflow context but not in standalone Agent app runs, because the standalone path populates model settings before they reach the plugin daemon.
- After applying the fix (v1.16.x+), agents running inside Chatflow/workflow nodes receive
completion_paramspopulated from the model's declared defaults, satisfying provider-level required field validation. - If upgrading is not immediately possible, manually re-saving the Agent node's model selection in the Chatflow editor can sometimes force a fresh configuration snapshot that avoids stale empty
completion_params.