From a2c77f49325dd697ff6048b0f553bc2831149317 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 27 Mar 2026 14:21:38 +0000 Subject: [PATCH] fix: remove auto-fetch on search, keep url param for explicit fetch The auto-fetch of top search results added ~2s latency per search without meaningfully improving results for small models that kept searching the wrong pages. Searches now return snippets only (fast) with a hint telling the model it can fetch any URL explicitly via the url parameter. Direct URL fetch remains available for when the model finds a relevant link and wants the full content. --- studio/backend/core/inference/tools.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/studio/backend/core/inference/tools.py b/studio/backend/core/inference/tools.py index b27a75cde1..a52819eedb 100644 --- a/studio/backend/core/inference/tools.py +++ b/studio/backend/core/inference/tools.py @@ -206,25 +206,17 @@ def _web_search( if not results: return "No results found." - # Fetch full page content for the top result (best-effort, - # capped at 10s so it does not block the agentic loop). - top_page = "" - for r in results[:2]: - href = r.get("href", "") - if href: - top_page = _fetch_page_text(href, max_chars = 6000, timeout = 10) - if len(top_page) > 200: - break parts = [] - for i, r in enumerate(results): - entry = ( + for r in results: + parts.append( f"Title: {r.get('title', '')}\n" f"URL: {r.get('href', '')}\n" f"Snippet: {r.get('body', '')}" ) - if i == 0 and top_page: - entry += f"\n\nPage content:\n{top_page}" - parts.append(entry) + parts.append( + "\nTip: To read the full content of any page above, " + "call web_search again with the url parameter." + ) return "\n\n---\n\n".join(parts) except Exception as e: return f"Search failed: {e}"