Skip to content

fix: OpenAPI tool _request missing timeout causes ReadTimeout with default httpx 5s #4431

@fuki01

Description

@fuki01

Bug Description

PR #2872 switched OpenAPI tools from requests (sync) to httpx.AsyncClient (async) in rest_api_tool.py. However, the new _request function does not specify a timeout parameter:

async def _request(**request_params) -> httpx.Response:
  async with httpx.AsyncClient(
      verify=request_params.pop("verify", True)
  ) as client:
    return await client.request(**request_params)
  • requests has no default timeout (waits indefinitely)
  • httpx.AsyncClient has a default timeout of 5 seconds

This means API calls that previously worked fine now fail with httpx.ReadTimeout if they take longer than 5 seconds.

Steps to Reproduce

  1. Configure an OpenAPI tool that calls a slower external API
  2. Upgrade from google-adk 1.23.0 to 1.24.0
  3. Execute a tool call that takes more than 5 seconds

Expected Behavior

The API call should succeed as it did in 1.23.0 with requests.

Actual Behavior

httpx.ReadTimeout is raised after 5 seconds.

Suggested Fix

Add an explicit timeout to httpx.AsyncClient in _request. The appropriate value is up to the ADK team, but the current implicit 5s default is too short for many real-world API calls.

Environment

  • google-adk: 1.24.0+
  • Python: 3.13

Metadata

Metadata

Assignees

Labels

tools[Component] This issue is related to tools

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions