diff --git a/src/agents/tools/web-fetch.ts b/src/agents/tools/web-fetch.ts index 0da9108591f..60bcf5326ab 100644 --- a/src/agents/tools/web-fetch.ts +++ b/src/agents/tools/web-fetch.ts @@ -32,6 +32,25 @@ import { export { extractReadableContent } from "./web-fetch-utils.js"; +const PROXY_ENV_KEYS = [ + "HTTPS_PROXY", + "HTTP_PROXY", + "ALL_PROXY", + "https_proxy", + "http_proxy", + "all_proxy", +] as const; + +function hasProxyEnvConfigured(): boolean { + for (const key of PROXY_ENV_KEYS) { + const value = process.env[key]; + if (typeof value === "string" && value.trim().length > 0) { + return true; + } + } + return false; +} + const EXTRACT_MODES = ["markdown", "text"] as const; const DEFAULT_FETCH_MAX_CHARS = 50_000; @@ -539,9 +558,11 @@ async function runWebFetch(params: WebFetchRuntimeParams): Promise