diff --git a/api/core/workflow/nodes/llm/entities.py b/api/core/workflow/nodes/llm/entities.py index f92f108e9e..e982ceccf2 100644 --- a/api/core/workflow/nodes/llm/entities.py +++ b/api/core/workflow/nodes/llm/entities.py @@ -392,7 +392,8 @@ class LLMNodeData(BaseNodeData): """ ), ) - + # Computer Use + computer_use: bool = Field(default=False, description="Whether to use the computer use feature") # Tool support tools: Sequence[ToolMetadata] = Field(default_factory=list) tool_settings: Sequence[ToolSetting] = Field(default_factory=list) diff --git a/api/core/workflow/nodes/llm/node.py b/api/core/workflow/nodes/llm/node.py index 5e33830ff9..67a1aea6ee 100644 --- a/api/core/workflow/nodes/llm/node.py +++ b/api/core/workflow/nodes/llm/node.py @@ -297,9 +297,10 @@ class LLMNode(Node[LLMNodeData]): generation_data: LLMGenerationData | None = None structured_output: LLMStructuredOutput | None = None - sandbox = self.graph_runtime_state.sandbox - has_skill_prompt = self._has_skill_prompt() - if sandbox and has_skill_prompt: + if self.node_data.computer_use: + sandbox = self.graph_runtime_state.sandbox + if not sandbox: + raise LLMNodeError("computer use is enabled but no sandbox found") tool_dependencies = self._extract_tool_dependencies() generator = self._invoke_llm_with_sandbox( sandbox=sandbox, @@ -422,8 +423,7 @@ class LLMNode(Node[LLMNodeData]): # Send final chunk event to indicate streaming is complete # For tool calls and sandbox, final events are already sent in _process_tool_outputs - sandbox_used = sandbox and has_skill_prompt - if not self.tool_call_enabled and not sandbox_used: + if not self.tool_call_enabled and not self.node_data.computer_use: yield StreamChunkEvent( selector=[self._node_id, "text"], chunk="", @@ -1822,12 +1822,6 @@ class LLMNode(Node[LLMNodeData]): generation_data, ) - def _has_skill_prompt(self) -> bool: - for prompt in self.node_data.prompt_template: - if isinstance(prompt, LLMNodeChatModelMessage) and prompt.skill: - return True - return False - def _extract_tool_dependencies(self) -> ToolDependencies | None: """Extract tool artifact from prompt template."""