diff --git a/api/core/workflow/nodes/agent/agent_node.py b/api/core/workflow/nodes/agent/agent_node.py index 932129d90e..704eb6a3ac 100644 --- a/api/core/workflow/nodes/agent/agent_node.py +++ b/api/core/workflow/nodes/agent/agent_node.py @@ -270,15 +270,14 @@ class AgentNode(BaseNode): ) extra = tool.get("extra", {}) - node_data = cast(AgentNodeData, self._node_data) # This is an issue that caused problems before. # Logically, we shouldn't use the node_data.version field for judgment # But for backward compatibility with historical data # this version field judgment is still preserved here. - runtime_variable_pool = ( - variable_pool if (node_data.version != "1" or node_data.tool_node_version != "1") else None - ) + runtime_variable_pool: VariablePool | None = None + if node_data.version != "1" or node_data.tool_node_version != "1": + runtime_variable_pool = variable_pool tool_runtime = ToolManager.get_agent_tool_runtime( self.tenant_id, self.app_id, entity, self.invoke_from, runtime_variable_pool ) diff --git a/api/core/workflow/nodes/tool/tool_node.py b/api/core/workflow/nodes/tool/tool_node.py index 42c3732f56..140fe71f60 100644 --- a/api/core/workflow/nodes/tool/tool_node.py +++ b/api/core/workflow/nodes/tool/tool_node.py @@ -74,11 +74,9 @@ class ToolNode(BaseNode): # Logically, we shouldn't use the node_data.version field for judgment # But for backward compatibility with historical data # this version field judgment is still preserved here. - variable_pool = ( - self.graph_runtime_state.variable_pool - if (node_data.version != "1" or node_data.tool_node_version != "1") - else None - ) + variable_pool: VariablePool | None = None + if node_data.version != "1" or node_data.tool_node_version != "1": + variable_pool = self.graph_runtime_state.variable_pool tool_runtime = ToolManager.get_workflow_tool_runtime( self.tenant_id, self.app_id, self.node_id, self._node_data, self.invoke_from, variable_pool )