diff --git a/autogpt_platform/backend/backend/api/features/chat/tools/sandbox.py b/autogpt_platform/backend/backend/api/features/chat/tools/sandbox.py index da0b362662..beb326f909 100644 --- a/autogpt_platform/backend/backend/api/features/chat/tools/sandbox.py +++ b/autogpt_platform/backend/backend/api/features/chat/tools/sandbox.py @@ -16,8 +16,6 @@ import shutil logger = logging.getLogger(__name__) -# Output limits — prevent blowing up LLM context -_MAX_OUTPUT_CHARS = 50_000 _DEFAULT_TIMEOUT = 30 _MAX_TIMEOUT = 120 @@ -253,8 +251,8 @@ async def run_sandboxed( stdout_bytes, stderr_bytes = await asyncio.wait_for( proc.communicate(), timeout=timeout ) - stdout = stdout_bytes.decode("utf-8", errors="replace")[:_MAX_OUTPUT_CHARS] - stderr = stderr_bytes.decode("utf-8", errors="replace")[:_MAX_OUTPUT_CHARS] + stdout = stdout_bytes.decode("utf-8", errors="replace") + stderr = stderr_bytes.decode("utf-8", errors="replace") return stdout, stderr, proc.returncode or 0, False except asyncio.TimeoutError: proc.kill() diff --git a/autogpt_platform/backend/backend/api/features/chat/tools/web_fetch.py b/autogpt_platform/backend/backend/api/features/chat/tools/web_fetch.py index 79f4da8cbe..fed7cc11fa 100644 --- a/autogpt_platform/backend/backend/api/features/chat/tools/web_fetch.py +++ b/autogpt_platform/backend/backend/api/features/chat/tools/web_fetch.py @@ -19,7 +19,6 @@ logger = logging.getLogger(__name__) # Limits _MAX_CONTENT_BYTES = 102_400 # 100 KB download cap -_MAX_OUTPUT_CHARS = 50_000 # 50K char truncation for LLM context _REQUEST_TIMEOUT = aiohttp.ClientTimeout(total=15) # Content types we'll read as text @@ -141,16 +140,12 @@ class WebFetchTool(BaseTool): if extract_text and "html" in content_type.lower(): text = _html_to_text(text) - truncated = len(text) > _MAX_OUTPUT_CHARS - if truncated: - text = text[:_MAX_OUTPUT_CHARS] - return WebFetchResponse( - message=f"Fetched {url}" + (" (truncated)" if truncated else ""), + message=f"Fetched {url}", url=response.url, status_code=response.status, content_type=content_type.split(";")[0].strip(), content=text, - truncated=truncated, + truncated=False, session_id=session_id, )