22#include <asio/awaitable.hpp>
28namespace neograph::a2a {
71 const std::string& text,
72 const std::string& task_id =
"",
73 const std::string& context_id =
"");
85 asio::awaitable<Task> get_task_async(
const std::string& task_id,
int history_length = 0);
89 asio::awaitable<Task> cancel_task_async(
const std::string& task_id);
108 Task send_message_stream(
const std::string& text,
110 const std::string& task_id =
"",
111 const std::string& context_id =
"");
117 json
rpc_call(
const std::string& method,
const json& params);
118 asio::awaitable<json> rpc_call_async(
const std::string& method,
const json& params);
127 const std::string& v1_method,
128 const std::string& v03_method,
131 const std::string& base_url()
const {
return base_url_; }
134 std::string base_url_;
135 std::chrono::seconds timeout_ = std::chrono::seconds(30);
140 bool card_loaded_ =
false;
Core data types for the Agent-to-Agent (A2A) protocol.
NEOGRAPH_API export/import macro for shared-library builds.
A2A client — call a remote agent over JSON-RPC + HTTP.
AgentCard fetch_agent_card(bool force=false)
GET /.well-known/agent-card.json.
asio::awaitable< AgentCard > fetch_agent_card_async(bool force=false)
Async variant of fetch_agent_card.
Task get_task(const std::string &task_id, int history_length=0)
tasks/get — fetch the latest snapshot of a task.
Task send_message_sync(const std::string &text, const std::string &task_id="", const std::string &context_id="")
message/send — convenience wrapper around send_message_sync().
EventCallback StreamCallback
Task cancel_task(const std::string &task_id)
tasks/cancel — request cancellation. Returns updated Task.
void set_timeout(std::chrono::seconds t)
Override the default 30 s request timeout.
std::function< bool(const StreamEvent &)> EventCallback
message/stream — send a message and receive SSE-framed status updates as the agent progresses,...
json rpc_call(const std::string &method, const json ¶ms)
Lower-level: arbitrary JSON-RPC method.
asio::awaitable< json > rpc_call_with_fallback(const std::string &v1_method, const std::string &v03_method, const json ¶ms)
Two A2A protocol generations are deployed in the wild: v1 (PascalCase, e.g.
asio::awaitable< Task > send_message_async(const MessageSendParams ¶ms)
Async variant — server's response payload may be either a Message or a Task; we coerce both into a Ta...
Task send_message_sync(const MessageSendParams ¶ms)
Send an arbitrary Message (multipart, file, structured data).
A2AClient(std::string base_url)
Subset of AgentCard required to interact (spec §5.5).
Params object for message/send and message/stream.
Tagged union over the two streaming event types + the terminal Task message.
A unit of work tracked by the agent (spec §6.1).