You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add timeout and URL scheme validation to load_web_page #4886
Is your feature request related to a specific problem?
The load_web_page() function in src/google/adk/tools/load_web_page.py calls requests.get() without a timeout parameter. If the target server is unresponsive, the agent hangs indefinitely with no way to recover. Additionally, the function accepts any URL scheme (file://, ftp://, etc.) and does not handle Timeout or ConnectionError exceptions, causing uncontrolled errors to propagate.
Describe the Solution You'd Like
Add timeout=10 to requests.get() to prevent indefinite hangs
Validate that the URL scheme is http or https before making the request
Handle requests.exceptions.Timeout and requests.exceptions.ConnectionError, returning descriptive error messages
Impact on your work
When building agents that use load_web_page as a tool, an unresponsive URL blocks the entire agent execution. This makes production deployments unreliable.
Willingness to contribute
Yes. I will submit a PR with the implementation and unit tests shortly.
Describe Alternatives You've Considered
Wrapping the tool call in a try/except at the agent level, but this pushes error handling to every consumer instead of solving it at the source.
Proposed API / Implementation
N/A - No API changes, only internal hardening. The function signature remains load_web_page(url: str) -> str.
Additional Context
The function already has SSRF protection via allow_redirects=False. These changes complement that existing hardening. The PR includes 11 unit tests covering all new behavior.
@cchinchilla-dev, Thank you for submitting. It’s currently under review by our team, and I’ll keep you posted on any updates. We appreciate your input!
Hi @GWeale, after rebasing onto the latest upstream/main, the SSRF rewrite already covers URL-scheme validation and the unified failure path. The only remaining gap is the request timeout, which #4887 now addresses. See the PR for details. Thanks!
Activity
feat: add timeout and URL scheme validation to load_web_page
sanketpatil06 commentedon Mar 24, 2026
@cchinchilla-dev, Thank you for submitting. It’s currently under review by our team, and I’ll keep you posted on any updates. We appreciate your input!
cchinchilla-dev commentedon Apr 30, 2026
Hi @GWeale, after rebasing onto the latest
upstream/main, the SSRF rewrite already covers URL-scheme validation and the unified failure path. The only remaining gap is the request timeout, which #4887 now addresses. See the PR for details. Thanks!feat: add request timeout to load_web_page
feat: add request timeout to load_web_page