strands.vended_tools.http_request.http_request
HTTP request tool for making raw HTTP calls to external APIs.
Provides :func:make_http_request (a factory that lets the tool operator
supply a custom HTTP client) and :data:http_request (a default instance).
The tool is a thin shim over httpx.AsyncClient. It delegates all
networking to the client instance provided by the operator, giving full
control over transport configuration, authentication, proxies, timeouts,
redirects, and connection pooling.
The parent agent’s cancel signal (Agent._cancel_signal) is propagated so
an in-flight fetch aborts when the agent is cancelled. Cancellation is
signalled with :class:asyncio.CancelledError.
HttpRequestError
Section titled “HttpRequestError”class HttpRequestError(RuntimeError)Defined in: src/strands/vended_tools/http_request/http_request.py:32
Raised when a request fails.
make_http_request
Section titled “make_http_request”def make_http_request( *, name: str = "http_request", description: str = DEFAULT_HTTP_REQUEST_DESCRIPTION, client: httpx.AsyncClient | None = None) -> DecoratedFunctionToolDefined in: src/strands/vended_tools/http_request/http_request.py:36
Create an HTTP request tool.
Arguments:
name- Tool name shown to the model.description- Tool description shown to the model.client- Optionalhttpx.AsyncClientinstance to use for requests. When provided, the tool uses this client directly — timeouts, redirects, proxies, auth, and all other transport settings are controlled by the client. The tool will not close it. WhenNone, a new client is created per request with httpx defaults.
Returns:
A decorated tool that makes HTTP requests.
http_request
Section titled “http_request”Default HTTP request tool.