diff --git a/agent/component/agent_with_tools.py b/agent/component/agent_with_tools.py index 3938dc03e..56f23afe3 100644 --- a/agent/component/agent_with_tools.py +++ b/agent/component/agent_with_tools.py @@ -249,9 +249,6 @@ class Agent(LLM, ToolBase): self.set_output("_ERROR", error) return - attachment_content = self._collect_tool_attachment_content(existing_text=ans) - if attachment_content: - ans += "\n\n" + attachment_content artifact_md = self._collect_tool_artifact_markdown(existing_text=ans) if artifact_md: ans += "\n\n" + artifact_md @@ -289,10 +286,6 @@ class Agent(LLM, ToolBase): answer += delta if not need2cite or cited: - attachment_content = self._collect_tool_attachment_content(existing_text=answer) - if attachment_content: - yield "\n\n" + attachment_content - answer += "\n\n" + attachment_content artifact_md = self._collect_tool_artifact_markdown(existing_text=answer) if artifact_md: yield "\n\n" + artifact_md @@ -307,10 +300,6 @@ class Agent(LLM, ToolBase): return yield delta cited_answer += delta - attachment_content = self._collect_tool_attachment_content(existing_text=cited_answer) - if attachment_content: - yield "\n\n" + attachment_content - cited_answer += "\n\n" + attachment_content artifact_md = self._collect_tool_artifact_markdown(existing_text=cited_answer) if artifact_md: yield "\n\n" + artifact_md @@ -346,21 +335,6 @@ class Agent(LLM, ToolBase): md_parts.append(f"[Download {art['name']}]({url})") return "\n\n".join(md_parts) - def _collect_tool_attachment_content(self, existing_text: str = "") -> str: - text_parts = [] - for tool_obj in self.tools.values(): - if not hasattr(tool_obj, "_param") or not hasattr(tool_obj._param, "outputs"): - continue - content_meta = tool_obj._param.outputs.get("_ATTACHMENT_CONTENT", {}) - content = content_meta.get("value") if isinstance(content_meta, dict) else None - if not content or not isinstance(content, str): - continue - content = content.strip() - if not content or content in existing_text: - continue - text_parts.append(content) - return "\n\n".join(text_parts) - def reset(self, only_output=False): """ Reset all tools if they have a reset method. This avoids errors for tools like MCPToolCallSession.