Skip to main content

http_request

Function http_request 

Source
pub fn http_request() -> FunctionTool
Expand description

The http_request tool: sends method to url with optional headers and body, and returns {status, statusText, headers, body} as JSON.

A status outside 2xx fails with HTTP <status> <statusText>: <method> <url>. The request fails after timeout seconds (30 when absent) and when the call is cancelled. Redirects are followed.

let agent = strands::Agent::builder()
    .tools([strands::vended_tools::http_request::http_request()])
    .printer(false)
    .build()?;
assert!(agent.tool_registry().get("http_request").is_some());