From c5eff58bf81b9e70dc05d2fa5317a5426e102cce Mon Sep 17 00:00:00 2001 From: majdyz Date: Wed, 22 Apr 2026 06:12:09 +0700 Subject: [PATCH] fix(backend/copilot): keep tool schema under char budget for web_search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trim web_search description + params (733 → 476 chars saved 257) and bump the schema char budget from 32_500 to 32_800 to absorb the remaining skeleton cost of a newly added LLM-facing primitive. Unblocks test_total_schema_char_budget in the py3.11/3.12/3.13 matrix. --- .../backend/copilot/tools/tool_schema_test.py | 6 +++++- .../backend/backend/copilot/tools/web_search.py | 16 ++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py b/autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py index e0403cdc79..7b370f810c 100644 --- a/autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py +++ b/autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py @@ -21,7 +21,11 @@ from backend.copilot.tools import TOOL_REGISTRY # response shape carries) and the dry_run description. Keeps the # regression gate effective while accepting a deliberate ~120-token # spend on LLM-decision-critical copy. -_CHAR_BUDGET = 32_500 +# Bumped 32500 -> 32800 on PR #12871 for the new web_search tool +# (server-side Anthropic beta). Description already trimmed to the +# minimum viable copy; the bump absorbs the schema skeleton cost +# (~300 chars / ~75 tokens) for a new LLM-facing primitive. +_CHAR_BUDGET = 32_800 @pytest.fixture(scope="module") diff --git a/autogpt_platform/backend/backend/copilot/tools/web_search.py b/autogpt_platform/backend/backend/copilot/tools/web_search.py index 22d9a82904..feb999d4d6 100644 --- a/autogpt_platform/backend/backend/copilot/tools/web_search.py +++ b/autogpt_platform/backend/backend/copilot/tools/web_search.py @@ -36,13 +36,9 @@ class WebSearchTool(BaseTool): @property def description(self) -> str: return ( - "Search the web and return cited results. Use this for live " - "information — news, current events, up-to-date docs, recent " - "releases — when the model's training data would be stale. " - "Returns a list of {title, url, snippet} plus the URLs so " - "``web_fetch`` can deep-dive any result. Costs a few cents " - "per search; prefer one well-targeted query over many " - "reformulations." + "Search the web for live info (news, recent docs). Returns " + "{title, url, snippet}; use web_fetch to deep-dive a URL. " + "Prefer one targeted query over many reformulations." ) @property @@ -52,13 +48,13 @@ class WebSearchTool(BaseTool): "properties": { "query": { "type": "string", - "description": "The search query — a question or topic.", + "description": "Search query.", }, "max_results": { "type": "integer", "description": ( - f"Maximum results to return (default " - f"{_DEFAULT_MAX_RESULTS}, hard cap {_HARD_MAX_RESULTS})." + f"Max results (default {_DEFAULT_MAX_RESULTS}, " + f"cap {_HARD_MAX_RESULTS})." ), "default": _DEFAULT_MAX_RESULTS, },