Files
moloapp/src/google/adk/remote_http.h
T
retoorandClaude Sonnet 5.5 33e6ab0d54 feat(clients): adk: agents, tools, runner with hard caps, multi-agent graph, MCP and A2A clients, Studio export, Garden, AP2, triggers
DirectModel over GoogleClient with thought-signature replay, discovery check
script, live verified against the real model (function calling, transfer, MCP).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 04:34:22 +02:00

46 lines
1.3 KiB
C++

#pragma once
// Thin bounded HTTP helper for the MCP and A2A clients: absolute http(s)
// URLs only, response body capped, non-2xx and transport failures mapped to
// AdkError ("upstream"). Runs over any clients::Client (MockTransport in
// tests).
#include <map>
#include <memory>
#include <string>
#include "clients/body/json.h"
#include "clients/client.h"
namespace molo::google::adk {
struct RemoteReply {
int status = 0;
clients::HeaderMap headers;
std::string body;
};
class RemoteHttp {
public:
// headers are sent on every request (e.g. Authorization). They are never
// echoed into errors.
explicit RemoteHttp(std::shared_ptr<clients::Client> http,
std::map<std::string, std::string> headers = {});
RemoteReply post_json(const std::string& url, const clients::body::Json& body,
const std::map<std::string, std::string>& extra = {});
RemoteReply get(const std::string& url,
const std::map<std::string, std::string>& extra = {});
// True for an absolute http:// or https:// URL without whitespace.
static bool valid_url(const std::string& url);
private:
RemoteReply finish(const std::string& url, clients::ClientRequest request);
std::shared_ptr<clients::Client> http_;
std::map<std::string, std::string> headers_;
};
} // namespace molo::google::adk