agentkit-http
HTTP client abstraction used across agentkit. The HttpClient trait
defines the single execute(HttpRequest) -> HttpResponse contract; the
Http handle wraps any Arc<dyn HttpClient> and exposes a
reqwest-style request builder (HttpRequestBuilder) for ergonomic call
sites.
A default reqwest-backed implementation ships behind the reqwest-client
feature, which is enabled by default. Disable it to compile trait-only
when you want to bring your own backend:
= { = "0.6", = false }
A second optional feature, reqwest-middleware-client, layers
reqwest-middleware on top
for retry / tracing middleware stacks.
Quick start
use ;
# async
Http exposes the usual get / post / put / patch / delete /
request constructors and is cheap to clone — it holds an Arc over the
underlying client.
Bring your own client
Any type that implements HttpClient plugs in unchanged. This is the seam
agentkit uses for stub clients in tests, custom TLS / proxy stacks, signing
middleware, and non-reqwest backends:
use Arc;
use ;
use async_trait;
;
let http = from_arc;
Responses are surfaced as a streaming body (BodyStream), so SSE consumers
can pull chunks incrementally rather than buffering the entire payload.