Turn a function into an `http.Agent` instance